R
R
ruslannafisovich2017-10-13 15:01:12
API
ruslannafisovich, 2017-10-13 15:01:12

ASP.NET CORE + JWT. How to renew a token?

From the specified material https://metanit.com/sharp/aspnet5/23.7.php you can see how the work with the token is configured. But I did not find a solution how to renew the token. What does that require? Create a separate method that will renew the token? Or is there a default setting?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
denismaster, 2018-05-26
@denismaster

To renew the token, you can send a request to /api/token/refresh some time before the token expires, in which the token is decoded and a new token is created based on it, which overwrites the old one.
You can also use refreshToken after the token has expired, but it is recommended not to store it on the client. In this case, a new pair of tokens is created, and the old ones are recognized as not valid.
Here are code examples
https://www.intertech.com/Blog/angular-4-tutorial-...
https://stackoverflow.com/questions/43467290/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question