hi, i have a problem I am trying to verifySession ...
# support-questions-legacy
k
hi, i have a problem I am trying to verifySession with api/user using the following document. https://supertokens.com/docs/thirdpartyemailpassword/nextjs/session-verification/in-api However, it works in the development environment, but returns 401 { message: "unauthorized"}. Why is this? I am developing the frontend with Next.js and the backend with Nest.js. I have set websiteDomain in the origin option of NextCors. We are using axios to make requests, get requests, withCredentials: true option.
r
Hey @kazumo
If backend is in nest js, why are you seeing NextJS api verification docs?
k
@rp_st On the front end, we are creating a function that switches the screen rendering depending on whether the user is logged in or not. Should I create an endpoint for verifySession on the backend and request it there? If so, should I use this function?
Copy code
import { verifySession } from 'supertokens-node/recipe/session/framework/express';
import { VerifySessionOptions } from 'supertokens-node/recipe/session';
r
So you want to do session verification on the sever side?
For that next js app
k
yes
And you also want to make sure that your session cookie is shared across your api and frontend app.
k
thanks, i check this