node.js - 节点 js 中的 Firebase 授权
问题描述
我有简单的 html、css 和 js 前端和 node.js 后端。我在后端使用 firebase 进行身份验证。现在如何保护或授权某些路由。
如果有人试图在没有适当身份验证的情况下访问路由(比如仪表板),那么他必须重定向到登录页面或任何错误消息页面。
解决方案
服务器的 firebase 实例本身发生了什么,它正在被验证,而不是向客户端返回验证数据。您应该做的是在请求中返回客户端身份验证令牌。这里有一节介绍服务器身份验证
https://firebase.google.com/docs/auth/admin/#custom_token_creation
还是问题?
推荐阅读
- c++ - Qt 创建者 Xbox One 控制器输入
- visual-studio - Visual Studio 在停靠窗口上崩溃
- python - 在同一轴上绘制 Matplotlib 中的两个图像
- vue.js - 客户端渲染的虚拟 DOM 树与服务器渲染的内容不匹配
- r - 如何结合两个因素使过滤更快?
- java - 如何通过外键找到数据集表中条目数量较少的行?
- qt - QTCreator 4.14.1 (Python) 中的错误:找不到匹配“ui_form.h”的文档
- java - 在java中将字符串转换为long
- logging - 自述文件或日志的字体设计 cli
- python - 在 Python 中从列表中删除内容