EvaE
Convex Community17mo ago
4 replies
Eva

Redirecting unauthenticated users? Convex Auth + TanStack Router

Hi! Hopefully this is an easy one, but I'm new to both Convex, TanStack, and this is my first time ever setting up authentication! So trying to follow best pratices and reading but getting a little lost.

I have a /settings route and I want to redirect unauthenticated users away to /signin. I found the docs in TanStack Router for how to set up a redirect on beforeLoad but I don't know how to check for isAuthenticated() using Convex Auth. Help?

https://tanstack.com/router/latest/docs/framework/react/guide/authenticated-routes#redirecting
Authentication is an extremely common requirement for web applications. In this guide, we'll walk through how to use TanStack Router to build protected routes, and how to redirect users to login if they try to access them.

The route.beforeLoad Option
Authenticated Routes | TanStack Router React Docs
Was this page helpful?