Error when trying to login in with Google
See original GitHub issueIssue and Steps to Reproduce
Create a Google OIDC client and try to use it with this library:
import {Provider} from "react-redux";
import {OidcProvider} from "@axa-fr/react-oidc-context";
const oidcConfig = {
client_id: 'your_google_client_id',
redirect_uri: `${location.protocol}//${location.host}/`,
scope: 'openid',
authority: 'https://accounts.google.com',
service_worker_only: false
};
const root = createRoot(document.getElementById('root'));
root.render(
<Provider store={store}>
<OidcProvider configuration={oidcConfig}>
<App/>
</OidcProvider>
</Provider>
);
Versions
Tried in version 5.3.1
Expected
Redirect to Google SSO
Actual
Before the actual redirect, the following error occurs because sessionStorage is empty:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.loadItemsAsync (initSession.ts:9:1)
at Oidc.<anonymous> (oidc.ts:419:1)
at step (noHashQueryStringUtils.ts:3:1)
at Object.next (noHashQueryStringUtils.ts:3:1)
at fulfilled (noHashQueryStringUtils.ts:3:1
Additional Details
I use React-Saga within my React application
Issue Analytics
- State:
- Created a year ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Can't sign in from a third-party service - Google Account Help
Your sign-in may be blocked if the device or location you're using is new. Try again from a device or location that you...
Read more >How To Fix Google Sign In Error On Android - velog
How to Fix Google login error on Android ... Existing app cache / data issues - As someone suggested, this can be resolved...
Read more >Google sign-in error on android phone - Error Solutions
Google sign-in error on android phone is an error that may simply be a sign-in issue, which sometimes occurs when the Play Store...
Read more >How To Fix Google Sign In Error On Android | 01 - Vocal Media
The error may simply be a login issue that sometimes occurs when updating the Play Store. The first trick is to go to...
Read more >FAQ: Why did I receive a Google Authentication Error?
The first thing you should try is refreshing your browser window, potentially even clearing your browser cache and then try to perform the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@guillaume-chervet thanks, I’ve worked out that we just need to use
useOidcIdToken
instead ofuseOidcAccessToken
when using Google for OIDC. Hopefully this comment helps someone else stumbling across this issue.Thank you so much @guillaume-chervet . I wish I found the example earlier 😃
One more issue though: the token request succeeds. But when trying to parse the response, the extractAccessTokenPayload method fails when trying to perform an atob operation on the returned token. The following exception occurs:
Is this a known issue? The access token returned by Google looks like this:
ya29.A0ARrd...
Edit: it looks like Google isn’t using a JWT as access token, while the library expects this (?)