谷歌访问令牌到期时间



当我从Google API获取access_token时,它带有一个expires_in值。 根据文档,此值指示"访问令牌的剩余生存期"。

此值的单位是什么?

规范说秒:

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.

我同意OP的观点,即谷歌不记录这一点是粗心的。

看看: https://developers.google.com/accounts/docs/OAuth2UserAgent#handlingtheresponse

它说:

响应中包含的其他参数包括expires_intoken_type .这些参数描述了令牌的生存期 秒。。。

由于没有公认的答案,我将尝试回答这个问题:

[s] - seconds

来自 Google OAuth2.0 客户端文档,

  • expires_in -- 令牌变为无效之前剩余的秒数。

最新更新