Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ describe('signInWithRedirect API', () => {
it('should try to clear oauth data before starting an oauth flow.', async () => {
// TODO: ADD Test: previous test was invalid
});

it('should call `assertUserNotAuthenticated` by default', async () => {
// TODO: ADD Test
});

it('should not call `assertUserNotAuthenticated` when skip set to true', async () => {
// TODO: ADD Test
});
});

describe('getRedirectUrl on web', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export async function signInWithRedirect(
assertTokenProviderConfig(authConfig);
assertOAuthConfig(authConfig);
store.setAuthConfig(authConfig);
await assertUserNotAuthenticated();
if (input?.options?.skipAssertUserNotAuthenticated !== true) {
await assertUserNotAuthenticated();
}

let provider = 'COGNITO'; // Default

Expand Down
4 changes: 4 additions & 0 deletions packages/auth/src/types/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export type AuthSignInWithRedirectInput = {
* On all other platforms, this flag is ignored.
*/
preferPrivateSession?: boolean;
/**
* Setting this to true will allow you to sign in even when a user is authenticated.
*/
skipAssertUserNotAuthenticated?: boolean;
};
};

Expand Down