更新时间:2023-12-06 08:34:04
** UPDATE ** 现在也记录在 Firebase REST 文档中的 Exchange a refresh token for an ID token
部分:
** UPDATE ** this is also now documented in Firebase REST docs under Exchange a refresh token for an ID token
section:
https://firebase.google.com/docs/reference/rest/auth/#section-refresh-token
目前我发现的唯一方法是在这里:https://developers.google.com/identity/toolkit/reference/securetoken/rest/v1/token
Currently the only way I found to do this is here: https://developers.google.com/identity/toolkit/reference/securetoken/rest/v1/token
您必须发出 HTTP 请求:
You must make an HTTP request:
POST
https://securetoken.googleapis.com/v1/token?key=YOUR_KEY
可以在 Google 开发者控制台中找到 YOUR_KEY
的位置 >API 管理器凭据.它位于 API Keys
部分下.
Where YOUR_KEY
can be found in the Google developers console > API Manager > Credentials. It's under the API Keys
section.
确保请求正文的结构如下:
Make sure request body is structured in the following format:
grant_type=refresh_token&refresh_token=REFRESH_TOKEN
其中 REFRESH_TOKEN
是 Firebase 用户对象登录时的刷新令牌.
Where REFRESH_TOKEN
is the refresh token from Firebase user object when they signed in.
您必须设置标题 Content-Type: application/x-www-form-urlencoded
否则您将收到错误(例如MISSING_GRANT_TYPE").
You must set the header Content-Type: application/x-www-form-urlencoded
or you will get errors (e.g. "MISSING_GRANT_TYPE").
POST
调用将返回一个新的 idToken
(以前称为 access_token
)
The POST
call will return a new idToken
(used to be called access_token
)