为什么我们使用JWT代替firebase

发布于 2025-01-25 07:04:51 字数 84 浏览 1 评论 0原文

我们可以通过firebase或通过保存到数据库的电子邮件来验证用户。但是拥有这些系统为什么我们使用JWT(JSON Web令牌)?是否有使用它的特定原因?

We can verify a user by firebase or by their email that saved to the database. But having these system why do we use JWT (json web token)? Is there any specific reason to use it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽清梦 2025-02-01 07:04:51

一旦您对用户进行身份验证,您需要将某种代币还给客户端,以表明它们是授权客户端,因此当下一个请求进来时,他们可以发送该令牌,而不必从scratch进行重新验证。

有多种方法可以做到这一点。您可以创建一个会话cookie(例如在使用Expresssession时),也可以使用JWT,它是标准化类型的令牌类型的令牌,可以验证或过期等等...令牌技术。这只是一个常见的,有充分支持的选择。

Once you authenticate a user, you need to give back to the client some sort of token that indicates they are an authorized client so when the next request comes in, they can send just that token and not have to reauthenticate from scratch.

There are a number of ways to do that. You can create a session cookie (like when using express-session) or you can use a JWT which is a standardized type of token that is signed and can be verified or expired, etc... There's no requirement to use JWT specifically as the token technology. It's just one common, well-supported option.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文