So <@!498057949541826571> , my final code is like ...
# support-questions-legacy
d
So @User , my final code is like this. It seems a bit verbose for me, so please confirm if this is the simplest away to get a user email on NextJS server-side:
Copy code
import { superTokensNextWrapper } from "supertokens-node/nextjs";
import { verifySession } from "supertokens-node/recipe/session";
import { getUserById } from "supertokens-node/recipe/thirdpartyemailpassword";

export async function getServerSideProps(context) {
    await superTokensNextWrapper(
        async next => {
            return await verifySession()(context.req, context.res, next);
        },
        context.req,
        context.res
    );

    const { userId } = context.req.session;
    const userData = await getUserById(userId);

    return { props: { userData } };
}
(I'll do more things with the user email there, I am just copying the relevant code here)