Google access token expiration time

Oauth 2.0

Oauth 2.0 Problem Overview


When I obtain an access_token from the Google API, it comes with an expires_in value. According to the documentation, this value indicates "The remaining lifetime of the access token".

What are the units of this value?

Oauth 2.0 Solutions


Solution 1 - Oauth 2.0

The spec says seconds:

https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-22#section-4.2.2

expires_in
    OPTIONAL.  The lifetime in seconds of the access token.  For
    example, the value "3600" denotes that the access token will
    expire in one hour from the time the response was generated.

I agree with OP that it's careless for Google to not document this.

Solution 2 - Oauth 2.0

Have a look at: https://developers.google.com/accounts/docs/OAuth2UserAgent#handlingtheresponse

It says:

> Other parameters included in the response include expires_in and > token_type. These parameters describe the lifetime of the token in > seconds...

Solution 3 - Oauth 2.0

Since there is no accepted answer I will try to answer this one:

[s] - seconds

Solution 4 - Oauth 2.0

From Google OAuth2.0 for Client documentation,

  • expires_in -- The number of seconds left before the token becomes invalid.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFrank LaRosaView Question on Stackoverflow
Solution 1 - Oauth 2.0Lawrence KestelootView Answer on Stackoverflow
Solution 2 - Oauth 2.0steweView Answer on Stackoverflow
Solution 3 - Oauth 2.0msysmiluView Answer on Stackoverflow
Solution 4 - Oauth 2.0Davide CastronovoView Answer on Stackoverflow