SuperTokens integration with Router
Hi! I am looking for a good example of SuperTokens integration with Tanstack Router / Tanstack Start. Anyone have a working example, or could point me in the right direction?
3 Replies
rival-blackOP•4mo ago
Some context, I'm using Tanstack Start but I want to have a dedicated express server for the authentication features provided by SuperTokens. Therefore I don't want to make the server inside my Start application. So, I need some starting point to set it up with the react router. Also, I do not intent to use their pre-build UI - but create my own.
foreign-sapphire•4mo ago
Reading the Supertokens docs, it provides it's own auth server (managed or self hosted), so you just init a connection on both start and express and the tokens should work on both
foreign-sapphire•4mo ago
I'd say run
Supertokens.Init
in router.tsx
and run doesSessionExist
in beforeLoad
methods. https://supertokens.com/docs/quickstart/frontend-setup#5-protect-frontend-routesFrontend Setup | SuperTokens Docs
Configure your frontend application for SuperTokens authentication, including SDK installation and session management.