Sometimes getAuthResponse returned access_token to undefined.
See original GitHub issuehi.
Sometimes access_token is not defined after logging in.
So I debugged and found that function getAuthResponse, which is used in the library, was returning undefined.
The official document states that access_token
is not returned when:
By default, the access token and requested scopes are not returned when fetched_basic_profile is true (the default value) and no additional scopes are required.
I have to specify fetched_basic_profile
as true, and scope
as profile email
.
The default value for this library is the same as the value I should use, so I didn’t specify it in the code.
I am using the login component as below.
<GoogleLogin
render={LoginButton}
clientId={googleClientId}
onRequest={onGoogleLoginRequest}
onSuccess={onGoogleLoginSuccess}
onFailure={onGoogleLoginFailure}
cookiePolicy=“single_host_origin”
/>
To solve this problem, I would like to modify the parameter of function getAuthResponse
.
Or is there another better solution?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
gapi.auth2 can not get access_token - Stack Overflow
access_token and g-signin . So I've been trying to use the auth2 functions to get the access tokens, but the access_token property is...
Read more >getTokenSilently returns undefined token for lots of concurrent ...
I have an API utility making all my requests from my fronted React app. It calls getTokenSilently each time I make an API...
Read more >Migrate to Google Identity Services | Authorization
Access tokens are short-lived, and often valid only for a few minutes. ... After consent, an access token is returned along with a...
Read more >"Failed to obtain access token" callback message when ...
Occasionally I am getting below and mostly Failed to Obtain access token. BadRequest-Cannot read property 'idp' of undefined.
Read more >Client API - NextAuth.js
The session data returned to the client does not contain sensitive ... when the session hasn't been fetched yet, data will be undefined...
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
@Sultanyaron As the README and GoogleUser object said, You should add
true
as a parameter togetAuthResponse()
.@phanshiwen It is working properly and i am getting the token with the following:
According to the definition file getAuthResponse don’t accept args, this is something that need to get fixed.