Skip to content

Commit 1f12bb0

Browse files
committed
add assertUserNotAuthenticated option to signInWithRedirect
1 parent 6a68983 commit 1f12bb0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/auth/src/providers/cognito/apis/signInWithRedirect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export async function signInWithRedirect(
4444
assertTokenProviderConfig(authConfig);
4545
assertOAuthConfig(authConfig);
4646
store.setAuthConfig(authConfig);
47-
await assertUserNotAuthenticated();
47+
if (input?.options?.assertUserNotAuthenticated !== false) {
48+
await assertUserNotAuthenticated();
49+
}
4850

4951
let provider = 'COGNITO'; // Default
5052

packages/auth/src/types/inputs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export type AuthSignInWithRedirectInput = {
6565
* On all other platforms, this flag is ignored.
6666
*/
6767
preferPrivateSession?: boolean;
68+
/**
69+
* Setting this to false will allow you to sign in even when a user is authenticated.
70+
*/
71+
assertUserNotAuthenticated?: boolean;
6872
};
6973
};
7074

0 commit comments

Comments
 (0)