I work with bigquery API, and my question is how to get a long duration of the access_token, cauz it's always just for one hour How to manage it? how to avoid the way that every one hour I have to retrieve a new token? is the API credentiel could replace the token? if yes how to manage the scope? Thank you so much for your replies
Asked
Active
Viewed 1,478 times
1 Answers
2
There is no way around the short-life span of the access token; there is no way to tell Google to give me an access token that will last more than about an hour. Access token is meant to be temporary.
So, the access token is going to expire after some time. And the user/app will need to get authenticated again to obtain a new access token from Google.
If your app needs access to a Google API beyond the lifetime of a single access token, it can obtain a refresh token. So, the user/app will have to obtain a long-term "refresh token" from Google, store it somewhere safe on the server.
Read more about Refresh the Access Token: https://developers.google.com/identity/protocols/OAuth2

Mikhail Berlyant
- 165,386
- 8
- 154
- 230