How do we use supertokens with our own UI when als...
# support-questions
k
How do we use supertokens with our own UI when also using SSR?
r
Hey!
Have a look at the NextJS guide > session verification > with ssr
Even if you have not using NextJS, it’s similar
k
I don't see an ssr section in there?
oh this one?
r
Yea exactly
It will only work if the apiDomain === websiteDomain
k
So the backend needs to get the session and send prop data to the frontend?
r
Well you can do whatever you like with the session info on the server side
k
I think my problem is different
r
Can you elaborate?
k
Here's the error I'm getting
Copy code
exports.validateAndNormaliseInputOrThrowError = validateAndNormaliseInputOrThrowError;
function getWindowOrThrow() {
    if (typeof window === "undefined") {
        throw Error(
            "If you are using this package with server-side rendering, please make sure that you are checking if the window object is defined."
        );
    }
    return window;
}
So maybe I actually need to use the framework to not execute a supertokens frontend function unless its executing on the frontend?
r
Yes. That would be a solution. You can do that via the dynamic HOC provided by NextJS
As you can see in there
k
I'm using Nuxt, which I'm realizing was a bad choice
r
Hehe. Well.. they must have some equivalent
k
So in your NextJS example, the server is getting the session and passing props to a component
Does the component use the props and get rendered on the server side?
r
Yes.
k
ahh ok so that would also potentially work for me
r
Yup. But you’d have to use NextJS
k
Thanks!