ShEsKo
ShEsKo

Reputation: 157

JSON Web Token Implementation: access and refresh token

I am about to implement an authentication system that uses the JSON Web Token(JWT) approach. I read online multiple approaches taken but they seem to always be slightly different than the on I'm thinking on using.

The approach I am thinking of is:

I believe that this approach has the following advantages:

Could anyone comment on this? Is this a good approach?

Upvotes: 1

Views: 886

Answers (1)

pedrofb
pedrofb

Reputation: 39291

The objective of refresh tokens is allow applications to obtain a new access token without re-authenticate minimizing the effect of a stolen token. If you allow to renew automatically including a refresh ID in the token itself, you are in fact extending the lifetime of the token without deliberately requiring the refresh token

An attacker who stoles a JWT could indefinitely impersonate user until the user performs a new access and ID does not match.

I think it is more secure to obtain a new access token before it expire using specifically the refresh token

Upvotes: 1

Related Questions