Skip to content

Commit

Permalink
tweak for oauth sync
Browse files Browse the repository at this point in the history
  • Loading branch information
vpomerleau committed Nov 22, 2024
1 parent 63e208d commit db079eb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,22 @@ const SetPasswordContainer = ({
});

let keyFetchToken;
if (!isOAuthNative) {
// We must reauth for another `keyFetchToken` because it was used in
// the oauth flow
const reauth = await authClient.sessionReauthWithAuthPW(
sessionToken,
email,
authPW,
{
keys: true,
reason: 'signin',
}
);
// TODO, handle this better? Should we display a message to the user saying
// their password was created but they need to sign in again?
if (!reauth.keyFetchToken) throw new Error('Invalid keyFetchToken');
keyFetchToken = reauth.keyFetchToken;
}

// We must reauth for another `keyFetchToken` because it was used in
// the oauth flow
const reauth = await authClient.sessionReauthWithAuthPW(
sessionToken,
email,
authPW,
{
keys: true,
reason: 'signin',
}
);
// TODO, handle this better? Should we display a message to the user saying
// their password was created but they need to sign in again?
if (!reauth.keyFetchToken) throw new Error('Invalid keyFetchToken');
keyFetchToken = reauth.keyFetchToken;

const syncEngines = {
offeredEngines: offeredSyncEngines,
Expand Down
5 changes: 3 additions & 2 deletions packages/fxa-settings/src/pages/Signin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,14 @@ const getOAuthNavigationTarget = async (
};
}
return { error };
}
}

if (navigationOptions.integration.isSync()) {
return {
...getSyncNavigate(
navigationOptions.queryParams,
locationState.showInlineRecoveryKeySetup
locationState.showInlineRecoveryKeySetup,
navigationOptions.isSignInWithThirdPartyAuth
),
oauthData: {
code,
Expand Down

0 comments on commit db079eb

Please sign in to comment.