Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth integration #128

Merged
merged 45 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
76026e3
feat(login): login using oauth
matthieusieben Jun 12, 2024
cf37682
Various fixes linked to oauth
matthieusieben Jul 2, 2024
ed59541
style: various minor updates
matthieusieben Jul 2, 2024
2b07e2b
fix(external-labelers): avoid un-necessary invalidation of queries
matthieusieben Jul 2, 2024
93102bb
tidy
matthieusieben Jul 2, 2024
72196d3
fix(oauth): adapt to latest client changes
matthieusieben Jul 9, 2024
b24adb2
feat(tabs): expose current view
matthieusieben Jul 9, 2024
a6e51d0
Merge remote-tracking branch 'origin/main' into oauth-matthieu
matthieusieben Jul 9, 2024
99f27ce
fix: external labelers
matthieusieben Jul 9, 2024
a52ee6f
improve init time
matthieusieben Jul 9, 2024
b3be988
fix(repositories): list profiles using labeler instead of PDS
matthieusieben Jul 10, 2024
7059cf2
style: remove un-necessary "encoding" param from api calls
matthieusieben Jul 10, 2024
64ed75c
fix: rename import from @atproto/api
matthieusieben Jul 11, 2024
a6966a5
:rightwards_twisted_arrows: Merge with upstream
foysalit Aug 8, 2024
7cae67c
:bug: Adjust for new oauth and atproto api package changes
foysalit Aug 13, 2024
82594d8
:white_check_mark: Add manual wait
foysalit Aug 13, 2024
1f830ac
:broom: Cleanup
foysalit Aug 13, 2024
cde9677
:twisted_rightwards_arrows: Merge with upstream
foysalit Aug 23, 2024
664e531
:broom: Cleanup
foysalit Aug 23, 2024
9043ba1
Adapt to latest SDK changes
matthieusieben Aug 28, 2024
bc8c2a7
fix definition of loopback client
matthieusieben Aug 28, 2024
3b2ce66
Fix cleint_id and metadata
matthieusieben Aug 29, 2024
ad6137f
:bug: Fix initial setup sequence bugs
foysalit Aug 29, 2024
def67fd
:sparkles: Add feature flag for oauth login tab
foysalit Aug 29, 2024
efafeea
fix logout not happening error
matthieusieben Aug 29, 2024
1079db0
Allow automatic hiding of tabs
matthieusieben Aug 30, 2024
b1161e8
wip: config
matthieusieben Aug 30, 2024
42e224d
wip: auth
matthieusieben Aug 30, 2024
2eb4791
Update components/shell/ConfigurationFlow.tsx
matthieusieben Aug 30, 2024
0ab7fd4
Merge remote-tracking branch 'origin/main' into oauth-matthieu
matthieusieben Aug 30, 2024
35e7f92
Update lib/client-config.ts
matthieusieben Aug 30, 2024
8339284
Update lib/constants.ts
matthieusieben Aug 30, 2024
b97202d
Update cypress/support/api.ts
matthieusieben Aug 30, 2024
c45e715
add missing NEXT_PUBLIC_HANDLE_RESOLVER_URL in env config
matthieusieben Aug 30, 2024
d8e8d28
update dep
matthieusieben Aug 30, 2024
7a3934d
code cleanup
matthieusieben Aug 30, 2024
1e718b2
restore default OZONE_PUBLIC_URL for dev mode
matthieusieben Aug 30, 2024
d3944a4
remove dev OZONE_PUBLIC_URL
matthieusieben Aug 30, 2024
82fa7df
fix local dev (yarn dev)
matthieusieben Aug 30, 2024
1e8d436
Add compatibility with legacy credentials
matthieusieben Aug 30, 2024
b5dfbcd
adapt to main merge
matthieusieben Sep 2, 2024
83243e8
:white_check_mark: Set correct fixture
foysalit Sep 2, 2024
9c51f6a
:white_check_mark: set cypress env vars for github ci
foysalit Sep 2, 2024
5425da0
:bug: Allow Only/Exclude/Indifferent filters for appeal status (#170)
foysalit Sep 3, 2024
b9e8fd8
Merge remote-tracking branch 'origin/main' into oauth-matthieu
matthieusieben Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions components/shell/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ export function AuthProvider({ children, ...options }: AuthProviderProps) {
!ozonePublicUrl || typeof window === 'undefined'
? undefined // Disabled server side
: isLoopbackHost(ozonePublicUrl.hostname)
? `http://localhost?redirect_uri=${encodeURIComponent(
new URL('/', ozonePublicUrl.origin).href as OAuthClientIdLoopback,
)}&scope=${OAUTH_SCOPE.split(' ').map(encodeURIComponent).join('+')}`
? // The following requires a yet to be released version of the oauth-client:
// &scope=${OAUTH_SCOPE.split(' ').map(encodeURIComponent).join('+')}
`http://localhost?redirect_uri=${encodeURIComponent(
new URL(
`http://127.0.0.1${
window.location.port ? `:${window.location.port}` : ''
}`,
).href,
)}`
: `${ozonePublicUrl.origin as `https://${string}`}/oauth-client.json`,
})

Expand Down
12 changes: 9 additions & 3 deletions lib/client-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ export async function getConfig(): Promise<OzoneConfig> {
if (labelerDid) {
doc = await resolveDidDocData(labelerDid)
const labelerUrl = doc && getServiceUrlFromDoc(doc, 'atproto_labeler')
if (labelerUrl) {
meta = await getOzoneMeta(labelerUrl)
if (process.env.NODE_ENV === 'development' && doc && labelerUrl) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't existence of labelerUrl imply that doc exists? not clear why we need to check for && doc here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is solely for the purpose of making this work with yarn dev

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with dev-env from atproto, there is no .well-known file, so the getOzoneMeta results in a 404.

I'm open to any other solution for this :-)

meta = {
did: labelerDid,
url: labelerUrl,
publicKey: getDidKeyFromDoc(doc, 'atproto_label')!,
}
} else {
meta = await getOzoneMeta(OZONE_PUBLIC_URL || window.location.origin)
meta = await getOzoneMeta(
labelerUrl || OZONE_PUBLIC_URL || window.location.origin,
)
}
} else {
meta = await getOzoneMeta(OZONE_PUBLIC_URL || window.location.origin)
Expand Down
Loading