ngx-auth icon indicating copy to clipboard operation
ngx-auth copied to clipboard

Refresh the token before making a new request

Open AhmedNourJamalElDin opened this issue 3 years ago • 2 comments

Hi,

Is it possible to check if it is needed to refresh the token before making a new request? As you know, there is an expires_at field where it is sometimes better to check it and refresh the token before making a request.

the flow when making a new request: 1- check expires_at 2- if expired, refresh and continue 3- make a request 4- if response is 401, refresh the token and retry

AhmedNourJamalElDin avatar Apr 05 '21 03:04 AhmedNourJamalElDin

I believe it can be achieved with the hooks provided by the library.

serhiisol avatar Apr 06 '21 14:04 serhiisol

Hi @serhiisol

Thanks for your response.

AhmedNourJamalElDin avatar Apr 06 '21 15:04 AhmedNourJamalElDin