How JWT token expiresIn works in feathers?

后端 未结 1 484
太阳男子
太阳男子 2020-12-22 07:57

When I decode my JWT token I see in payload

{
  \"exp\": 1494105589
}

What does it value means? Docs says that default JWT expiresIn value

相关标签:
1条回答
  • 2020-12-22 08:36

    it's a unix timestamp, counting the seconds since 1st of January 1970 00:00 UTC. There are several websites that help you to convert the value, eg. this one : http://www.unixtimestamp.com/index.php For your timestamp it says 05/06/2017 @ 9:19pm (UTC), so your token is valid for 5 month.

    https://tools.ietf.org/html/rfc7519#section-4.1.4 explains that a numeric date is used for the exp claim (and also for the nbf (not before) and iat (issued at) claims)

    https://tools.ietf.org/html/rfc7519#section-2 defines the numeric date:

    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.

    beside that you said

    And the worst: this value not changed much when I set "expiresIn": "90d" in my config.

    when you got the token, did it come in a structure like this :

    {"access_token": "eyJhbGciOiJ...", "token_type": "bearer", "expires_in": 86399 }
    

    and if yes, did expires_in show the correct value ?

    0 讨论(0)
提交回复
热议问题