https://supertokens.com/ logo
#support-questions
Title
# support-questions
d

deltasoneca

03/19/2021, 12:37 PM
Hello, I am new to Supertokens and I hope I can get some help here. I am using Supertokens SaaS version and implementing it on NextJS. I used NextJS template and it's working fine. This template has a function to fetch user data happening on the client, but I want to fetch user data from the server. In NextJS that means running inside
getServerSideProps()
. It is not advised to use
fetch()
there as the template does in the client side. So what should I do? I was able to make it work using the code below, but I am not sure it's the best way to do it -- I just adapted the code present in the template. Also this does not return the email used for login (I am not using social login). I need the email.
Copy code
await superTokensNextWrapper(
    async next => {
    return await verifySession()(context.req, context.res, next);
    },
    context.req,
    context.res
);

const { userId } = await context.req.session;
Any help is appreciated! Thanks!