Hello, I was playing with Supertokens using react ...
# support-questions
n
Hello, I was playing with Supertokens using react and express, trying to just to get the auth page following the docs (https://supertokens.com/docs/thirdpartyemailpassword/quick-setup/frontend). SuperTokens.getRoutingComponent was not working until I have add (window as any).global = window; Is this missing in the document or was I doing something wrong?
r
Hey! You don’t need to assign to global in there.
Can u see how you are using getRoutingComponent?
n
Here are the ts files
Here is the error when the (window as any).global = window line is commented out
I'm using vite btw (don't know if relevant)
r
You need to make sure that
SuperTokens.canHandleRoute()
is called only on the client side
n
Hmm, how can I do that?
r
That you will have to see how it's done in vite
n
Ohh, didn't realize the ssr part of vite, I'll check it out. Thanks!
I think this is the reason why global does not exist, as you said it is coming from vite. So the (window as any).global = window becomes the solutions 😄 (vite issue link: https://github.com/vitejs/vite/issues/2778) Again, thanks for the support!
r
hmm. I see.
2 Views