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

feat(clerk-expo): Deprecate useOAuth and introduce docs for useSSO #1908

Merged
merged 27 commits into from
Feb 4, 2025
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2e34970
Add bare draft for `useSSO` docs
LauraBeatris Jan 16, 2025
1e71a1a
Update snippets
LauraBeatris Jan 16, 2025
69c704d
update
victoriaxyz Jan 16, 2025
7f52af6
fix intros to code examples
victoriaxyz Jan 16, 2025
bcb5f9c
fix: Rollback guides for deprecated `useOAuth`
LauraBeatris Jan 17, 2025
2a15e4e
chore: Add deprecation warning
LauraBeatris Jan 17, 2025
bc2e51c
chore: Remove `redirectUrl` from properties
LauraBeatris Jan 17, 2025
bb12f81
chore: Improve description for `strategy` property
LauraBeatris Jan 17, 2025
ba4aed0
chore: Fix `useSSO` link
LauraBeatris Jan 17, 2025
36f8ba9
docs review
alexisintech Jan 17, 2025
11600ff
update oauth connections custom flow guide
alexisintech Jan 17, 2025
5c6d895
Update strategies types from OAuth-specific to general SSO (#1907)
LauraBeatris Jan 17, 2025
ba8abea
fix broken links
alexisintech Jan 17, 2025
cad401c
fix links
alexisintech Jan 21, 2025
6d51c33
Update `useSSO` with latest interface
LauraBeatris Jan 24, 2025
7187a29
Update deep link path for SSO callback
LauraBeatris Jan 24, 2025
17b642c
Update Expo overview to mention `useSSO`
LauraBeatris Jan 24, 2025
80081e5
Update snippets
LauraBeatris Jan 24, 2025
81107e2
Rollback OAuth connections changes
LauraBeatris Jan 24, 2025
d4c8941
Merge branch 'main' into laura/orgs-471-update-docs-for-clerkexpo
alexisintech Jan 30, 2025
0a5b335
docs review
alexisintech Jan 30, 2025
7d3fd2f
remove whitelist info from usesso doc
alexisintech Jan 31, 2025
01eef70
add callout; update todo
alexisintech Feb 4, 2025
1fff4b9
final docs review :fingerscrossed:
alexisintech Feb 4, 2025
0f6e969
Merge branch 'main' into laura/orgs-471-update-docs-for-clerkexpo
alexisintech Feb 4, 2025
5a8a7f9
Add reference for `authSessionResult`
LauraBeatris Feb 4, 2025
9c269f1
Fix linting and formatting
LauraBeatris Feb 4, 2025
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
Prev Previous commit
Next Next commit
Update deep link path for SSO callback
LauraBeatris committed Jan 28, 2025
commit 7187a2993bacb5d31fa6a61b25b1d11cb781fea5
4 changes: 2 additions & 2 deletions docs/_partials/expo/sso-custom-flow.mdx
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
const onPress = useCallback(async () => {
try {
const { createdSessionId, setActive, signIn, signUp } = await startSSOFlow({
strategy: 'oauth_google'
strategy: 'oauth_google',
})

// If sign in was successful, set the active session
@@ -93,7 +93,7 @@
const { createdSessionId, setActive, signIn, signUp } = await startSSOFlow({
strategy: 'enterprise_sso',
// This identifier would likely be derived from a text input
identifier: '[email protected]'
identifier: '[email protected]',
})

// If sign in was successful, set the active session
18 changes: 3 additions & 15 deletions docs/deployments/deploy-expo.mdx
Original file line number Diff line number Diff line change
@@ -15,23 +15,11 @@ With Clerk, you can [add OAuth flows in your Expo applications](/docs/custom-flo

Clerk ensures that security critical nonces will be passed only to allowlisted URLs when the OAuth flow is complete in native browsers or webviews.

So for maximum security in your production instances, you need to allowlist your custom redirect URLs:
So for maximum security in your production instances, you need to allowlist the OAuth callback URL:

1. In the Clerk Dashboard, navigate to the [**SSO connections**](https://dashboard.clerk.com/last-active?path=user-authentication/sso-connections) page.
1. Scroll to the **Allowlist for mobile OAuth redirect** section and add your redirect URLs.
1. The default is `<INSERT-YOUR-APP-SCHEME>://oauth-native-callback`
1. If you'd like to pass a custom redirect URL, make sure you add that to the allowlist. The format is `<INSERT-YOUR-APP-SCHEME>/{PATH}`. For example, the redirect URL for the following code example is `myapp://dashboard`.
```ts
const { startOAuthFlow } = useOAuth({ strategy: `oauth_apple` })

const onPress = React.useCallback(async () => {
const { createdSessionId, setActive } = await startOAuthFlow({
redirectUrl: Linking.createURL('dashboard', { scheme: 'myapp' }),
})

// The rest of your code...
}, [])
```
1. Scroll to the **Allowlist for mobile SSO redirect** section and add your redirect URLs.
1. The default is `<INSERT-YOUR-APP-SCHEME>://sso-callback`

> [!TIP]
> You can also add redirect URLs via [the Backend API](/docs/reference/backend-api/tag/Redirect-URLs#operation/CreateRedirectURL){{ target: '_blank' }}.
9 changes: 5 additions & 4 deletions docs/references/expo/use-sso.mdx
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ The `useSSO()` hook is used to create a new SSO flow. It can be used in both web

The `useSSO()` hook returns the `startSSOFlow()` method, which you can use to initiate the SSO flow.

The `startSSOFlow()` method has the following signature:

It accepts the following parameters (`StartSSOFlowParams`):

## Parameters
@@ -41,9 +39,12 @@ It accepts the following parameters (`StartSSOFlowParams`):

## How to use the `useSSO()` hook

To ensure maximum security in production, you must allowlist the SSO callback URL in your Clerk Dashboard by following these steps:
Clerk ensures that security critical nonces will be passed only to allowlisted URLs when the SSO flow is complete in native browsers or webviews.

So for maximum security in your production instances, you need to allowlist your the SSO callback URL in your Clerk Dashboard by following these steps:

1. Navigate to [**SSO connections**](https://dashboard.clerk.com/last-active?path=user-authentication/sso-connections)
2. Under **Allowlist for mobile OAuth redirect**, add `<INSERT-YOUR-APP-SCHEME>://sso-callback`
1. Under **Allowlist for mobile SSO redirect**, add `<INSERT-YOUR-APP-SCHEME>://sso-callback`

> [!TIP]
> You can also add redirect URLs via [the Backend API](/docs/reference/backend-api/tag/Redirect-URLs#operation/CreateRedirectURL){{ target: '_blank' }}.