GoogleCloudPlatform / ide-login

The plugins-login-common library for authenticating with the Google Cloud Platform shared by several IDE plugins including Google Cloud Tools for Eclipse, Google Cloud Tools for IntelliJ, and Android Studio.
Apache License 2.0
2 stars 9 forks source link

Refreshing access tokens? #28

Closed chanseokoh closed 6 years ago

chanseokoh commented 7 years ago

It seems that Credential automatically refreshes its access token if it expires soon, or if there is no access token, so we may not need to be bothered about manually refreshing it.

https://github.com/google/google-oauth-java-client/blob/dev/google-oauth-client/src/main/java/com/google/api/client/auth/oauth2/Credential.java#L217

chanseokoh commented 6 years ago

I have never been 100% certain to assert this, but as I said above, I think there is no need to refresh it. We have a refresh token, which doesn't expire (barring some rare events), and looking at code and from our experience, the access token is automatically refreshed.

We may still try to refresh access tokens, but I am not sure if there is a merit with it.