L
L
Leopandro2019-04-01 21:22:24
Angular
Leopandro, 2019-04-01 21:22:24

How to refresh token after each request?

There is such a task - to change the token after each request is completed, I need this so that the blocked user cannot continue to remain in the system, and the jwt token system does not imply this. The problem is that I did not find how to make a handler that will be processed after each request is made, I need something like HttpInterceptor-a, only after the request and not before.
angular 7

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jedi, 2019-04-01
@PHPjedi

Services. But it's stupid to update the token every time. What for?

N
nApoBo3, 2019-04-01
@nApoBo3

How will you invalidate the token? Store them in a service and prevent reuse?
It is easier or to make tokens with a very short lifetime not tied to the number of requests. Or implement an analogue of crl, i.e. disabled tokens are entered into a sheet and this sheet is either requested each time or synchronized. The leaf will not grow because the tokens in it are only within their validity period, and forced invalidation of the token is a rather rare situation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question