Skip to content

Commit 1744c89

Browse files
committed
fix(js): keep native OAuth transport callbacks inside the component router
1 parent be1317c commit 1744c89

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎packages/clerk-js/src/utils/__tests__/authenticateWithTransport.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('_authenticateWithTransport', () => {
4343
expect(resource.create).not.toHaveBeenCalled();
4444
});
4545

46-
it('replaces a page-derived redirectUrlComplete with the transport URL so FAPI only ever validates the registered callback', async () => {
46+
it('replaces a page-derived redirectUrlComplete with the transport URL', async () => {
4747
const clerk = makeClerk();
4848
const transport = {
4949
getRedirectUrl: vi.fn().mockResolvedValue('myapp://app/'),

‎packages/clerk-js/src/utils/authenticateWithTransport.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ export async function _authenticateWithTransport(opts: {
7171
const redirectUrl = String(await opts.transport.getRedirectUrl());
7272

7373
let verificationUrl: URL | string | undefined;
74-
// Production FAPI validates both URLs against the instance's redirect allowlist, and only the
75-
// transport callback is guaranteed to be registered. Page-derived completion URLs (e.g. a modal's
76-
// window.location.href) would be rejected; the app's real destination is handled client-side via
77-
// `callbackParams` after the callback completes.
74+
// Production FAPI validates both URLs against the redirect allowlist and only the transport
75+
// callback is guaranteed registered; the app's destination is navigated client-side instead.
7876
await opts.authenticateMethod({ ...opts.params, redirectUrl, redirectUrlComplete: redirectUrl }, url => {
7977
verificationUrl = url;
8078
});

‎packages/shared/src/types/clerk.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,9 +1328,7 @@ export type HandleOAuthCallbackParams = TransferableOption &
13281328
/**
13291329
* Internal navigation hook used by Clerk UI to keep intermediate OAuth callback navigations
13301330
* (continue, factor steps, sign-in/sign-up switches) inside the component's own router when the
1331-
* callback completes in-process (transport flows). Without it, these navigations fall back to
1332-
* window-level navigation, which breaks modal flows in native apps. Not set by the web
1333-
* redirect/popup paths.
1331+
* callback completes in-process (transport flows). Not set by the web redirect/popup paths.
13341332
*
13351333
* @internal
13361334
*/

0 commit comments

Comments
 (0)