WaspW
Wasp14mo ago
Joaquim

Check if user has auth token

Hey! What's the best way to check if the user has an auth token?

I don't want for useAuth to resolve before redirecting to the landing page if the user is logged out. If my server is lagging or broken, I would rather logged out people to be immediately redirected to the landing than waiting on a loading screen.

I was thinking that I can check if the client has the local storage var wasp:sessionId set. If not, I immediately redirect to the landing.

Does this make sense? Should I be worried about this var name being changed in the future?
Was this page helpful?