Best way to protect routes in TanStack Start?
What's the best way to protect all private routes like
Below is my attempt, but session is always
I'm using
CC @daveycodez Looking through the msg history, it appears you contributed the TanStack Start example, but I don't see this aspect in the example. Maybe you know?
/dashboard*, so they redirect to /login if no session exists? I don't see this aspect in the example: https://github.com/better-auth/better-auth/tree/main/examples/tanstack-exampleBelow is my attempt, but session is always
null, even if the user is authenticated.I'm using
authClient.getSession() b/c I believe this needs to work for both SSR and in the client.CC @daveycodez Looking through the msg history, it appears you contributed the TanStack Start example, but I don't see this aspect in the example. Maybe you know?
GitHub
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
