JWT (JSON Web Token) automatic prolongation of expiration

后端 未结 12 2183
一向
一向 2020-11-22 10:56

I would like to implement JWT-based authentication to our new REST API. But since the expiration is set in the token, is it possible to automatically prolong it? I don\'t wa

12条回答
  •  独厮守ぢ
    2020-11-22 11:31

    Good question- and there is wealth of information in the question itself.

    The article Refresh Tokens: When to Use Them and How They Interact with JWTs gives a good idea for this scenario. Some points are:-

    • Refresh tokens carry the information necessary to get a new access token.
    • Refresh tokens can also expire but are rather long-lived.
    • Refresh tokens are usually subject to strict storage requirements to ensure they are not leaked.
    • They can also be blacklisted by the authorization server.

    Also take a look at auth0/angular-jwt angularjs

    For Web API. read Enable OAuth Refresh Tokens in AngularJS App using ASP .NET Web API 2, and Owin

提交回复
热议问题