#Remix Manage Auth State

1 messages · Page 1 of 1 (latest)

light kite
#

First time playing around with Remix. I’ve created my first app yesterday and I am trying to figure out how to manage my Auth state:

  • I have a backend server that allows me to log in: it returns a JWT access token that is valid for a couple minutes and a refresh JWT token that is valid for a couple days.

What is the best practice when it comes to logging in with Remix, storing the AccessToken & refreshToken.
I also want to make sure that if the token is expired that I automatically refresh it without having to put that logic in each authenticated component.

Could you help me?

feral flume
#

@light kite I think there's tradeoffs on strategies you choose.
If you use SSR + SPA, it's simpler. Basically you refresh token on client side. On server side, you only verify the token .

#

I consider it's "best practice" for now.

#

If you do it in purely server side, you have to verify + refresh token on every request.

light kite
#

Do you know if there is an GitHub repo with an example of that?