我正在编写一个应用程序,我想在其中使用 Firebase 对任何类型的后端调用进行身份验证。有没有办法让我通过 CLI 或 curl
获取 token 进行本地测试,而无需启动前端来获取 token ?
最佳答案
作为 @James-Poag 答案的简历(对我和其他人来说),请使用:
curl 'https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=[API_KEY]' \
-H 'Content-Type: application/json' \
--data-binary '{"email":"[user@example.com]","password":"[PASSWORD]","returnSecureToken":true}'
地点:
password
(string): The password for the account.
returnSecureToken
(boolean): Whether or not to return an ID and refresh token. Should always be true.
响应负载中的属性 idToken
是您要查找的参数。
关于firebase - 获取 Firebase token 以进行后端测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53009059/