有没有办法制作用于开发的 firebase 身份验证令牌?

2024-05-02

背景

我正在构建一个 React Native 应用程序,它将数据发布到节点服务器,然后通过管理 Firebase 库将数据发布到 Firebase。

为了发布数据,我完全绕过应用程序并使用postman https://www.getpostman.com/docs/为了速度。

Problem

我的路由现在使用应包含 firebase 身份验证令牌的身份验证标头。要获取此令牌,我需要以用户身份登录我的应用程序并记录该令牌并将其复制出来以在邮递员中使用。这需要时间,并且令牌的有效期仅为 1 小时。

Question

有没有办法将 firebase 置于“开发模式”并在我的授权标头中使用持久令牌或其他技术来加速该过程?


我得到了我的答案here https://stackoverflow.com/a/72766800/16306754谢谢用户680141 https://stackoverflow.com/users/8035620/user680141.

您需要在 firebase 上创建一个示例用户,然后使用Firebase 身份验证 REST API https://firebase.google.com/docs/reference/rest/auth#section-sign-in-email-password.

然后您可以使用以下命令直接从 POSTMAN 获取令牌

https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword

体内有这些物品:

{
    key: "YOUR_API_KEY"  <= you need to put your firebase api key here
    email: "[email protected] /cdn-cgi/l/email-protection",
    password: "your-password",
    returnSecureToken: true
}

目前还没有办法获得用于开发的持久令牌,但这应该会加快这一过程。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

有没有办法制作用于开发的 firebase 身份验证令牌? 的相关文章

随机推荐