DEV Community

Salman Asu
Salman Asu

Posted on

3 2 2 2 2

flow design for access and refresh token- JWT

let build low-level-design for the same.

login the user with credential and validate it after…

Image description

one’s the token is store on both side server and client. if now user try to access the pages authenticate the user with that token’s

Image description

first validate the access token, if the access token is expire than validate the refresh token to generate new access token and refresh token.

if refresh token is also expire than redirect the user to login route. after success credential generate new access token and refresh token and repeate the same cycle.

note: every time when we generate new token, we generate both new access token and refersh token.

@sallbro

Top comments (1)

Collapse
 
shaqeeb_shaikh_c521433785 profile image
Shaqeeb Shaikh

amazing

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay