question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not refreshing access token automatically

See original GitHub issue

Environment details

  • OS: Windows 10 64x
  • Node.js version: 12.16.3
  • npm version: 6.14.4
  • googleapis version: 59.0.0

Steps to reproduce

I expect the API to automatically refresh the access token on the next API call after it expires, but I only get an “Invalid Client” error. I can successfully access the API and upload/download google drive files until the access token expires, so I know the tokens I received from the API on first signin are valid. I have that same refresh token assigned to the oauth2client immediately before any request. I can verify that they are set via console.log. Is there some missing step to get the API to “automatically refresh the access token” as it says in the documentation?

	oAuth2Client.setCredentials({
		access_token: googleAccessToken,
		refresh_token: googleRefreshToken
  });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:25 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
calculuschildcommented, Sep 11, 2020

Is there a preferred workaround until this is fixed?

3reactions
madaher-devcommented, Apr 24, 2021

How does this solve the issue if you did not change anything from the code he wrote?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to refresh OAuth access token automatically
We are facing an issue related to the Freshdesk OAuth access token regeneration automatically. The APP does not authorize or perform OAuth 2.0 ......
Read more >
What Are Refresh Tokens and How to Use Them Securely
This post will explore the concept of refresh tokens as defined by OAuth 2.0. We will learn how they compare to other token...
Read more >
Solved: When to refresh an access token? - 391930
Hi all,. According to the docs, An access token, if not used, will expire in 24 hours. In addition, according to information from...
Read more >
Should access tokens be refreshed automatically or manually?
Automatically Refreshing​​ For every request that requires authentication/authorization, the user will send both tokens on the request headers. ...
Read more >
Refresh Access Token | ReadyAPI Documentation
ReadyAPI automatically updates the access token using the refresh token. You need to click Refresh to update the access token using the refresh...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found