【发布时间】:2021-12-17 02:10:26
【问题描述】:
我的应用程序通过POST https://oauth2.googleapis.com/token API 获取访问令牌和刷新令牌。
响应包含access_token、expires_in、refresh_token。
我可以使用访问令牌调用 gmail API,例如 GET https://gmail.googleapis.com/gmail/v1/users/me/profile API。
但我无法使用刷新令牌刷新访问令牌。
请求
POST https://oauth2.googleapis.com/token
{
client_id: <client_id>,
client_secret: <client_secret>,
grant_type: "refresh_token",
refresh_token: <refresh_token>
}
回应
{
error: "unauthorized_client",
error_description: "Unauthorized"
}
访问令牌有效但刷新令牌在同一响应中无效,这很奇怪。
并不是每个谷歌账户都会出现这个问题。
谢谢。
【问题讨论】:
-
developers.google.com/identity/protocols/oauth2 上的“刷新令牌过期”下面的条件之一是否适用于您的情况?
-
@RonaldKorze 刷新令牌过期的错误消息是 Invalid_token not aunauthorzed_client。
标签: oauth google-oauth