TanStackT
TanStack2mo ago
27 replies
popular-magenta

beforeLoad redirecting to our login even when user is authenticated properly

Hey! My team is having an interesting problem we can't seem to pin down. We are using Better Auth + Tanstack start.

We have an auth server that lives on an external url with the same domain but different sub than our main app. Right now, we are getting the auth state on beforeLoad, and we throw a redirect to login if the user is not authenticated. However, it is doing this even when we are authenticated. None of our logs are also firing in our check to see if the session does not exist with a proper session. We do see it fire when we actually do not have a valid session though.

Snippets incoming
Was this page helpful?