Skip to content

Commit f57c9d1

Browse files
committed
fix(clerk-js): Navigate to factor-two when authenticate with web3 and response status is needs_second_factor
1 parent 164001c commit f57c9d1

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

.changeset/new-plants-lick.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Handle two factor redirect when authenticate with web3 and multifactor has been enabled

packages/clerk-js/src/core/clerk.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -1808,11 +1808,20 @@ export class Clerk implements ClerkInterface {
18081808
}
18091809
}
18101810

1811-
if (signInOrSignUp.createdSessionId) {
1812-
await this.setActive({
1813-
session: signInOrSignUp.createdSessionId,
1814-
redirectUrl,
1815-
});
1811+
switch (signInOrSignUp.status) {
1812+
case 'needs_second_factor':
1813+
await navigate('factor-two');
1814+
break;
1815+
case 'complete':
1816+
if (signInOrSignUp.createdSessionId) {
1817+
await this.setActive({
1818+
session: signInOrSignUp.createdSessionId,
1819+
redirectUrl,
1820+
});
1821+
}
1822+
break;
1823+
default:
1824+
return;
18161825
}
18171826
};
18181827

0 commit comments

Comments
 (0)