fix(clerk-expo): Accept custom redirect URL for SSO callback#5102
Conversation
🦋 Changeset detectedLatest commit: 36107df The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
1f2839f to
51f56ba
Compare
|
!snapshot |
|
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.20-snapshot.v20250207205117 --save-exact
npm i @clerk/backend@1.24.0-snapshot.v20250207205117 --save-exact
npm i @clerk/chrome-extension@2.2.8-snapshot.v20250207205117 --save-exact
npm i @clerk/clerk-js@5.52.2-snapshot.v20250207205117 --save-exact
npm i @clerk/elements@0.22.21-snapshot.v20250207205117 --save-exact
npm i @clerk/clerk-expo@2.7.6-snapshot.v20250207205117 --save-exact
npm i @clerk/expo-passkeys@0.1.19-snapshot.v20250207205117 --save-exact
npm i @clerk/express@1.3.47-snapshot.v20250207205117 --save-exact
npm i @clerk/fastify@2.1.20-snapshot.v20250207205117 --save-exact
npm i @clerk/localizations@3.10.5-snapshot.v20250207205117 --save-exact
npm i @clerk/nextjs@6.11.2-snapshot.v20250207205117 --save-exact
npm i @clerk/nuxt@1.1.3-snapshot.v20250207205117 --save-exact
npm i @clerk/clerk-react@5.22.12-snapshot.v20250207205117 --save-exact
npm i @clerk/react-router@1.0.7-snapshot.v20250207205117 --save-exact
npm i @clerk/remix@4.4.23-snapshot.v20250207205117 --save-exact
npm i @clerk/shared@2.21.0-snapshot.v20250207205117 --save-exact
npm i @clerk/tanstack-start@0.9.5-snapshot.v20250207205117 --save-exact
npm i @clerk/testing@1.4.21-snapshot.v20250207205117 --save-exact
npm i @clerk/themes@2.2.17-snapshot.v20250207205117 --save-exact
npm i @clerk/types@4.45.1-snapshot.v20250207205117 --save-exact
npm i @clerk/ui@0.3.22-snapshot.v20250207205117 --save-exact
npm i @clerk/vue@1.1.11-snapshot.v20250207205117 --save-exact |
51f56ba to
272bc3f
Compare
272bc3f to
41c7bbc
Compare
41c7bbc to
5a152f7
Compare
|
!snapshot |
|
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.20-snapshot.v20250207220806 --save-exact
npm i @clerk/backend@1.24.0-snapshot.v20250207220806 --save-exact
npm i @clerk/chrome-extension@2.2.8-snapshot.v20250207220806 --save-exact
npm i @clerk/clerk-js@5.52.2-snapshot.v20250207220806 --save-exact
npm i @clerk/elements@0.22.21-snapshot.v20250207220806 --save-exact
npm i @clerk/clerk-expo@2.7.6-snapshot.v20250207220806 --save-exact
npm i @clerk/expo-passkeys@0.1.19-snapshot.v20250207220806 --save-exact
npm i @clerk/express@1.3.47-snapshot.v20250207220806 --save-exact
npm i @clerk/fastify@2.1.20-snapshot.v20250207220806 --save-exact
npm i @clerk/localizations@3.10.5-snapshot.v20250207220806 --save-exact
npm i @clerk/nextjs@6.11.2-snapshot.v20250207220806 --save-exact
npm i @clerk/nuxt@1.1.3-snapshot.v20250207220806 --save-exact
npm i @clerk/clerk-react@5.22.12-snapshot.v20250207220806 --save-exact
npm i @clerk/react-router@1.0.7-snapshot.v20250207220806 --save-exact
npm i @clerk/remix@4.4.23-snapshot.v20250207220806 --save-exact
npm i @clerk/shared@2.21.0-snapshot.v20250207220806 --save-exact
npm i @clerk/tanstack-start@0.9.5-snapshot.v20250207220806 --save-exact
npm i @clerk/testing@1.4.21-snapshot.v20250207220806 --save-exact
npm i @clerk/themes@2.2.17-snapshot.v20250207220806 --save-exact
npm i @clerk/types@4.45.1-snapshot.v20250207220806 --save-exact
npm i @clerk/ui@0.3.22-snapshot.v20250207220806 --save-exact
npm i @clerk/vue@1.1.11-snapshot.v20250207220806 --save-exact |
5a152f7 to
4350565
Compare
4350565 to
e5ba1b1
Compare
e5ba1b1 to
36107df
Compare
|
!snapshot |
|
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.20-snapshot.v20250208212231 --save-exact
npm i @clerk/backend@1.24.0-snapshot.v20250208212231 --save-exact
npm i @clerk/chrome-extension@2.2.8-snapshot.v20250208212231 --save-exact
npm i @clerk/clerk-js@5.52.2-snapshot.v20250208212231 --save-exact
npm i @clerk/elements@0.22.21-snapshot.v20250208212231 --save-exact
npm i @clerk/clerk-expo@2.7.6-snapshot.v20250208212231 --save-exact
npm i @clerk/expo-passkeys@0.1.19-snapshot.v20250208212231 --save-exact
npm i @clerk/express@1.3.47-snapshot.v20250208212231 --save-exact
npm i @clerk/fastify@2.1.20-snapshot.v20250208212231 --save-exact
npm i @clerk/localizations@3.10.5-snapshot.v20250208212231 --save-exact
npm i @clerk/nextjs@6.11.2-snapshot.v20250208212231 --save-exact
npm i @clerk/nuxt@1.1.3-snapshot.v20250208212231 --save-exact
npm i @clerk/clerk-react@5.22.12-snapshot.v20250208212231 --save-exact
npm i @clerk/react-router@1.0.7-snapshot.v20250208212231 --save-exact
npm i @clerk/remix@4.4.23-snapshot.v20250208212231 --save-exact
npm i @clerk/shared@2.21.0-snapshot.v20250208212231 --save-exact
npm i @clerk/tanstack-start@0.9.5-snapshot.v20250208212231 --save-exact
npm i @clerk/testing@1.4.21-snapshot.v20250208212231 --save-exact
npm i @clerk/themes@2.2.17-snapshot.v20250208212231 --save-exact
npm i @clerk/types@4.45.1-snapshot.v20250208212231 --save-exact
npm i @clerk/ui@0.3.22-snapshot.v20250208212231 --save-exact
npm i @clerk/vue@1.1.11-snapshot.v20250208212231 --save-exact |
panteliselef
left a comment
There was a problem hiding this comment.
However, deep linking is working on Android
Did it got fixed in a specific version ? Regarding iOS, "not working" results to a noop or an error ?
| const redirectUrl = | ||
| startSSOFlowParams.redirectUrl ?? | ||
| AuthSession.makeRedirectUri({ | ||
| path: 'sso-callback', | ||
| }); |
There was a problem hiding this comment.
❓ Should redirectUrl be any string ? Should we be more strict and do
| const redirectUrl = | |
| startSSOFlowParams.redirectUrl ?? | |
| AuthSession.makeRedirectUri({ | |
| path: 'sso-callback', | |
| }); | |
| const redirectUrl = | |
| AuthSession.makeRedirectUri({ | |
| path: startSSOFlowParams.redirectUrl ?? 'sso-callback', | |
| }); |
There was a problem hiding this comment.
There are cases where developers might want to have more flexibility here, such as:
Directly passing the scheme as a property, even tho Expo inherits from the current build:
startSSOFlow({
redirectUrl: AuthSession.makeRedirectUri({
scheme: "myapp",
});
})Deep-link to the current route, without passing a path:
startSSOFlow({
redirectUrl:
// Defaults to the current route
AuthSession.makeRedirectUri();
})Or using the expo-linking package:
startSSOFlow({
redirectUrl: Linking.createURL("dashboard")
})
I haven't seen latest fixes on https://github.com/expo/expo/blob/main/packages/expo-auth-session/CHANGELOG.md, so I presume something was wrong on my latest deep linking tests when running Android on a simulator Here's the behavior for iOS providing CleanShot.2025-02-10.at.09.19.21.mp4The auth browser session returns with The deep linking provided to CleanShot.2025-02-10.at.09.20.10.mp4 |
Description
Context
The ability to pass a custom redirect URL was removed on the first version of
useSSO, testing back then, deep linking wasn't working for both platforms (iOS and Android), and the assumption was to leverage a fixed URL to parse the nonce token.However, deep linking is working on Android and some developers are falling into a 404 context.
Changes
This PR allows providing a custom redirect URL to
startSSOFlow, and also returns the result ofWebBrowser.openAuthSessionAsyncso developers can debug it's output on cases where the native configuration could be wrong, such as lacking permissions to open web browsers from the application manifest.Here's an OAuth flow deep linking to a custom redirect URL on Android:
CleanShot.Feb.8.2025.mp4
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change