Hello, I have query regarding Next.js and Ory Inte...
# talk-kratos
Hello, I have query regarding Next.js and Ory Integration, I can see session can be set based
but this same is available on server side?
Hello Dhruv, I am not quite sure what you are trying to do. Do you want to check if the user is logged in? You can do a whoami call for that. Let me know if that was where you were having trouble.
Sorry for the confusing question, but basically I am trying to setup API routes in next, so the route will return the data, if user is logged in else will return 401:
Copy code
import ory from '../../pkg/sdk'

export default async function handler(req, res) {
  if (req.method !== 'GET') {
    return res.status(405).send('Method Not Allowed')
  } else {
      .then(({ data }) => {
        console.log('Has User', JSON.stringify(data, null, 2))
      .catch((err) => {
        console.log('Has No User', err)
    return res.status(200).send({ ok: true, message: 'Testing' })
Ref: using the same code base as this: https://github.com/ory/kratos-selfservice-ui-react-nextjs