How JWT token expiresIn works in feathers?
当我解码JWT令牌时,我会在有效载荷中看到
1 2 3 | { "exp": 1494105589 } |
它的价值是什么意思? Docs表示,默认的JWT expiresIn值为" 1d",但这似乎不是令牌创建后的1天,甚至不是以ms(1000 * 60 * 60 * 24)表示的1天。 最糟糕的是:当我在配置中设置" expiresIn":" 90d"时,该值变化不大。 有人可以对此做些解释吗?
这是一个unix时间戳,计算从1970年1月1日00:00 UTC开始的秒数。
有几个网站可以帮助您转换价值,例如。 这个:http://www.unixtimestamp.com/index.php
对于您的时间戳,它表示的是05/06/2017 @ 9:19 pm(UTC),因此您的令牌有效期为5个月。
https://tools.ietf.org/html/rfc7519#section-4.1.4
解释了数字日期用于exp声明(以及nbf(不早于)和iat(发布于)声明)
https://tools.ietf.org/html/rfc7519#section-2
定义数字日期:
A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.
你还说
And the worst: this value not changed much when I set"expiresIn":
"90d" in my config.
当您获得令牌时,它是否具有以下结构:
1 | {"access_token":"eyJhbGciOiJ...","token_type":"bearer","expires_in": 86399 } |
如果是,expires_in是否显示正确的值?