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
other-emeraldOP•7mo 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.
rival-black•7mo 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
rival-black•7mo 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.