https://supertokens.com/ logo
#support-questions
SuperTokens, Open Source Authentication
# support-questions
v

Vaune_

05/03/2023, 8:11 PM
I'm attempting to follow the instructions here: https://supertokens.com/docs/emailpassword/pre-built-ui/setup/frontend I have the front, back, and core implemented, but I'm running into a hurdle adding the routes to my application. The docs indicate I can use
SuperTokens.getRoutingComponent
however, my TS is saying this function doesn't exist.
I'm planning on using https://github.com/tanstack/router as my routing component, so I think I need to get into some of the internals of the supertokens routing.
Currently, I don't see a way to bind routes. The documentation seems out of date.
Seems like I maybe can't use the prebuilt ui
I'm pretty confused on how to use SuperTokens in a react app.
Anyone available to answer some questions?
a

Adiboi

05/03/2023, 11:17 PM
Hey @Vaune_ , the engineering team will get back to you in 6-8 hours from now. Please check back then
r

rp

05/04/2023, 5:38 AM
hey @Vaune_ I think at the time you had seen our docs, it was outdated compared to the new SDK version. Please empty cache and hard reload the docs and the new snippet should work.
Using a different routing component other than the one we have can be tricky. You can see how we have added the nextjs router here for example: https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/config/frontendConfig.ts#L32 Would this kind of a method work for you?
v

Vaune_

05/05/2023, 4:13 AM
I've tried a bunch of different things, and I can't figure out how to wire this up correctly.
r

rp

05/05/2023, 4:14 AM
Right. I’m not familiar with this router, and it may not be possibly to add it in without a change in the SDK.
But you can use the router for the rest of your app and use full page reload for the auth route. And that would work
v

Vaune_

05/05/2023, 4:17 AM
I've gotten close I think. I have a custom ui that uses supertoken on the backend, I can sign in, reset password, signup, ect.
I'm having trouble figuring out the logic behind routing setup.
r

rp

05/05/2023, 4:18 AM
For custom ui, the routing is something that you control entirely.
So that’s outside the scope of supertokens
v

Vaune_

05/05/2023, 4:20 AM
Can the component still be used to wrap a component for session handling / redirection?
r

rp

05/05/2023, 4:20 AM
It can. But then that wouldn’t use your router.
So you should see the custom ui snippets
And maybe make your own version on SessionAuth that uses your router
v

Vaune_

05/05/2023, 4:21 AM
Hm, ok thank you.