Protected Routes in react with firebase auth for admin and user

问题描述 投票:0回答:1

如何在我的 React 项目中保护路由。我已经使用 firebase auth 进行身份验证。我的后端服务是 firebase。我如何保护管理员和用户端的路由。管理员和用户正在使用 firebase 身份验证

只是想在组件中设置受保护的路由,并可以将组件包装到路由中。在本地存储中存储访问令牌是否有任何问题。

reactjs firebase firebase-authentication react-router protected
1个回答
0
投票

您可以将 access token 存储在本地存储中,这没有问题。但是你可以按照这个guide来保护一些路线并且只能在有条件的情况下访问。

© www.soinside.com 2019 - 2024. All rights reserved.