Why oAuth2Client.on('tokens') function never trigger ?
See original GitHub issueHi everyone, I’m facing to this issue. I used these below codes to refresh access_token. But I realize that it never triggers, although the access_token expired already:
oauth2client.on('tokens', (tokens) => {
// But it never triggers
// store the refresh_token in my database!
}
Do anyone have a workaround for this ? Additional:
oAuth2Client.refreshAccessToken((error, tokens) => {
// return (Tokens is undefined)
})
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Google Authentication Token return doesn't contain ...
The refresh token is only sent once the first time user login to your application after approving the scopes you have specified.
Read more >Refresh Tokens - OAuth 2.0 Simplified
The expiration time of the refresh token is intentionally never communicated to the client. This is because the client has no actionable steps...
Read more >Google OAuth “invalid_grant” nightmare — and how to fix it
We had a lurking feeling that too many access tokens in a short time might trigger some temporary throttling by Google. A few...
Read more >Understanding OAuth2 and Deploying a Basic ... - Medium
This tutorial deploys 3 Cloud Functions. The token function is responsible for issuing access tokens while the auth function and the signin ...
Read more >Class OAuth2Client (8.7.0) | Node.js client library | Google Cloud
Constructs a new instance of the OAuth2Client class. Parameters ... Get a non-expired access token, after refreshing if necessary. Returns ...
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
@shinichimg an access token is short lived. Once you have a
refresh_token
, try setting your credentials like this:https://github.com/googleapis/google-auth-library-nodejs#retrieve-access-token
At which point, the next request to an API will request a new access token.
I’ve created one here.