gpt4 book ai didi

node.js - JWT(Json Web Token)的过期时间保存在哪里?

转载 作者:太空宇宙 更新时间:2023-11-03 22:56:48 26 4
gpt4 key购买 nike

我认为JSW认证流程如下。

  1. (客户端)在登录页面使用 ID 和密码调用 api
  2. (服务器)将 token (HEADER . CLAIM . SECRETKEY)返回给客户端
  3. (客户端)将 token 保存在本地存储中
  4. (客户端)使用 token 调用 api
  5. (服务器)检查 token 的有效性和到期时间,并将结果返回给客户端

验证方法5:解码后的HEADER和解码后的CLAIM的组合是否与SECRETKEY匹配。

我有一个问题。过期时间保存在哪里?

前南斯拉夫。我用过这个库。 https://github.com/auth0/node-jsonwebtoken

最佳答案

过期时间保存在 CLAIM 中。正如 RFC 中所写.

4.1. Registered Claim Names

4.1.4. "exp" (Expiration Time) Claim

The "exp" (expiration time) claim identifies the expiration time onor after which the JWT MUST NOT be accepted for processing. Theprocessing of the "exp" claim requires that the current date/timeMUST be before the expiration date/time listed in the "exp" claim.

此外,请查看 jwt.io它比 RFC 更容易阅读。

关于node.js - JWT(Json Web Token)的过期时间保存在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59905956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com