-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(auth): clear oauth data before initiating a new oauth flow (#12409)
* fix: call clearOauthData before starting the oauthf flow * chore: addess pr feedback * chore: address feedback
- Loading branch information
Showing
3 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 41 additions & 2 deletions
43
packages/auth/__tests__/providers/cognito/signInWithRedirect.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
describe.skip('signInWithRedirect API', () => { | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Amplify } from '@aws-amplify/core'; | ||
|
||
import * as signInWithRedirectModule from '../../../src/providers/cognito/apis/signInWithRedirect'; | ||
Amplify.configure({ | ||
Auth: { | ||
Cognito: { | ||
userPoolClientId: '111111-aaaaa-42d8-891d-ee81a1549398', | ||
userPoolId: 'us-west-2_zzzzz', | ||
loginWith: { | ||
oauth: { | ||
domain: 'mydomain.com', | ||
redirectSignIn: ['localHost:3000'], | ||
redirectSignOut: ['localHost:3000'], | ||
responseType: 'code', | ||
scopes: ['aws.cognito.signin.user.admin'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
describe('signInWithRedirect API', () => { | ||
let oauthSignInSpy; | ||
beforeEach(() => { | ||
oauthSignInSpy = jest | ||
.spyOn(signInWithRedirectModule, 'oauthSignIn') | ||
.mockImplementationOnce(async () => { | ||
return {}; | ||
}); | ||
}); | ||
afterEach(() => { | ||
oauthSignInSpy.mockClear(); | ||
}); | ||
it('should pass correct arguments to oauth', () => { | ||
// ADD tests | ||
// TODO ADD tests | ||
}); | ||
|
||
it('should try to clear oauth data before starting an oauth flow.', async () => { | ||
// TODO: ADD Test: previous test was invalid | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters