Skip to content

Commit

Permalink
Fix transfer flow
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Jan 22, 2025
1 parent 41e76d6 commit 9a43d07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/expo/src/hooks/useSSO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type StartSSOFlowParams = {

export type StartSSOFlowReturnType = {
createdSessionId: string | null;
authSessionResult?: WebBrowser.WebBrowserAuthSessionResult;
setActive?: SetActive;
signIn?: SignInResource;
signUp?: SignUpResource;
Expand All @@ -39,7 +40,6 @@ export function useSSO() {
}

const { strategy, unsafeMetadata } = startSSOFlowParams ?? {};
let createdSessionId = signIn.createdSessionId;

// Used to handle redirection back to the mobile application, however deep linking it not applied
// We only leverage it to extract the `rotating_token_nonce` query param
Expand All @@ -62,7 +62,7 @@ export function useSSO() {
const authSessionResult = await WebBrowser.openAuthSessionAsync(externalVerificationRedirectURL.toString());
if (authSessionResult.type !== 'success' || !authSessionResult.url) {
return {
createdSessionId,
createdSessionId: null,
setActive,
signIn,
signUp,
Expand All @@ -73,16 +73,16 @@ export function useSSO() {
const rotatingTokenNonce = params.get('rotating_token_nonce') ?? '';
await signIn.reload({ rotatingTokenNonce });

if (signIn.firstFactorVerification.status === 'transferable') {
const userNeedsToBeCreated = signIn.firstFactorVerification.status === 'transferable';
if (userNeedsToBeCreated) {
await signUp.create({
transfer: true,
unsafeMetadata,
});
createdSessionId = signUp.createdSessionId;
}

return {
createdSessionId,
createdSessionId: signUp.createdSessionId ?? signIn.createdSessionId,
setActive,
signIn,
signUp,
Expand Down

0 comments on commit 9a43d07

Please sign in to comment.