Gokul595 / api_guard

JWT authentication solution for Rails APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to send a new access token to the browser before the old access token expire?

rkcelestial opened this issue · comments

Hi,
I have an API service app with rails.
I'm getting Access-Token and Refresh-Token Once I had sign_in.
Every request I'm sending Authorization and Refresh-Token. Here I want to new access token before the current access token expire.
In the current situation automatically I'm getting Access token expired.

How can I auto-renew a new access token?

@rkcelestial You can get new access token using this API https://github.com/Gokul595/api_guard#refresh-access-token.

You can check for token expiry before each request and call this API before the request if the token is going to expire or expired. The expiry time of the token will be sent in the response headers of the sign in API.