在auth0 node-jsonwebtoken中,notbefore选项是什么?

时间:2019-09-28 23:07:01

标签: jwt auth0

我正在阅读https://github.com/auth0/node-jsonwebtoken#jwtsignpaypayload-secretorprivatekey-options-callback文档。

它说:

  
      
  • notBefore:以秒或描述时间跨度的字符串zeit/ms表示。      
        

    例如:60"2 days""10h""7d"。数值解释为秒计数。如果您使用字符串,请确保提供时间单位(天,小时等),否则默认使用毫秒单位("120"等于"120ms")。

      
  •   

此选项有什么用?

1 个答案:

答案 0 :(得分:1)

您可以查看此文档

https://tools.ietf.org/html/rfc7519

4.1.5. "nbf" (Not Before) Claim部分

The "nbf" (not before) claim identifies the time before which the JWT
   MUST NOT be accepted for processing.  The processing of the "nbf"
   claim requires that the current date/time MUST be after or equal to
   the not-before date/time listed in the "nbf" claim.  Implementers MAY
   provide for some small leeway, usually no more than a few minutes, to
   account for clock skew.  Its value MUST be a number containing a
   NumericDate value.  Use of this claim is OPTIONAL.