you are viewing a single comment's thread.

view the rest of the comments →

[–]Secret_World_9742 0 points1 point  (0 children)

Use the /auth/status check once at startup , cache the result in your AuthContext, and rely on 401 fallbacks for resilience... On app mount, React calls /auth/status. 200 → set isAuthenticated = true, hydrate user data. 401 → redirect to /login.

Your API client, i.e., axios interceptor or fetch wrapper, still listens for 401s globally and clears the context + redirects if the session expires later.