Skip to content

Commit

Permalink
fix: change callback method to allow other sign in method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizqi Hadi Prawira committed Sep 28, 2020
1 parent d05b964 commit c497f49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const AuthProvider: FC<AuthProviderProps> = ({
* Check if the user is returning back from OIDC.
*/
if (hasCodeInUrl(location)) {
await userManager.signinRedirectCallback();
await userManager.signinCallback();
const user = await userManager.getUser();
setUserData(user);
onSignIn && onSignIn(user);
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/AuthContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('AuthContext', () => {
getUser: async () => ({
access_token: 'token',
}),
signinRedirectCallback: jest.fn(),
signinCallback: jest.fn(),
} as any;
const { getByText } = render(
<AuthProvider userManager={userManager}>
Expand All @@ -90,7 +90,7 @@ describe('AuthContext', () => {
it('should login the user', async () => {
const userManager = {
getUser: jest.fn(),
signinRedirectCallback: jest.fn(),
signinCallback: jest.fn(),
} as any;
const location = {
search: '?code=test-code',
Expand All @@ -106,7 +106,7 @@ describe('AuthContext', () => {
);
await waitFor(() => expect(onSignIn).toHaveBeenCalled());
await waitFor(() =>
expect(userManager.signinRedirectCallback).toHaveBeenCalled(),
expect(userManager.signinCallback).toHaveBeenCalled(),
);
});

Expand Down

0 comments on commit c497f49

Please sign in to comment.