Skip to content

Commit

Permalink
Merge branch 'main' into feat/graphql-multi-client/main
Browse files Browse the repository at this point in the history
  • Loading branch information
svidgen authored Dec 21, 2024
2 parents 9302b10 + 0f81bef commit 3549f4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions packages/auth/src/client/utils/store/signInStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ type SignInAction =
| { type: 'SET_SIGN_IN_SESSION'; value?: string }
| { type: 'RESET_STATE' };

// Minutes until stored session invalidates
const MS_TO_EXPIRY = 3 * 60 * 1000; // 3 mins
// Minutes until stored session invalidates is defaulted to 3 minutes
// to maintain parity with Amazon Cognito user pools API behavior
const MS_TO_EXPIRY = 3 * 60 * 1000;
const TGT_STATE = 'CognitoSignInState';
const SIGN_IN_STATE_KEYS = {
username: `${TGT_STATE}.username`,
Expand Down Expand Up @@ -104,7 +105,7 @@ const getDefaultState = (): SignInState => ({
signInSession: undefined,
});

// Hydrate signInStore from syncSessionStorage
// Hydrate signInStore from syncSessionStorage if the session has not expired
const getInitialState = (): SignInState => {
const expiry = syncSessionStorage.getItem(SIGN_IN_STATE_KEYS.expiry);

Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/providers/cognito/apis/confirmSignIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export async function confirmSignIn(
This most likely occurred due to:
1. signIn was not called before confirmSignIn.
2. signIn threw an exception.
3. page was refreshed during the sign in flow.
3. page was refreshed during the sign in flow and session has expired.
`,
recoverySuggestion:
'Make sure a successful call to signIn is made before calling confirmSignIn' +
'and that the page is not refreshed until the sign in process is done.',
'and that the session has not expired.',
});

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
"name": "[Auth] Basic Auth Flow (Cognito)",
"path": "./dist/esm/auth/index.mjs",
"import": "{ signIn, signOut, fetchAuthSession, confirmSignIn }",
"limit": "30.88 kB"
"limit": "30.89 kB"
},
{
"name": "[Auth] OAuth Auth Flow (Cognito)",
Expand Down

0 comments on commit 3549f4a

Please sign in to comment.