absmach / magistrala-ui

UI Repository for Magistrala IoT
9 stars 15 forks source link

[FEATURE] Add Token Expiration time to token cookies #18

Closed ianmuchyri closed 7 months ago

ianmuchyri commented 9 months ago

Is there an existing feature request for this?

Is your feature request related to a problem? Please describe.

No response

Describe the feature you are requesting, as well as the possible use case(s) for it.

We add expiration time to tokens as we add them to browser cookies

Indicate the importance of this feature to you.

Anything else?

No response

ianmuchyri commented 7 months ago

The access token and refresh token cookies Expires time will be fetched from the respective tokens and added to the cookie. When the access token expires, the token middleware will check if the error is no-cookie and trigger the token refresh. If the refresh token has expired and is no longer part of the cookies, the browser will redirect to the login page