Similar but different to thread: https://discord.com/channels/967097582721572934/1179404220106035291
Setup:
- I'm running Payload@beta with a Next.js app in my local dev environment (Mac, VScode, etc.)
- My login page is
/signinwhich calls/api/users/logininhandleSubmit() - Login successfully completes and creates a valid
payload-tokencookie which I have verified is correct here: https://jwt.io/ - I have a React HOC
withAuth()wrapping the page components in my app - Inside
withAuth()I am calling/api/users/meto verify the user is logged in so I can restrict access based on roles
ERROR
/api/users/meis returning a 200 response, but theresponse.json()data is{ user: null, message: 'Account' }
Troubleshooting
- I have confirmed
process.env.SERVER_URLis set correctly ashttp://localhost:3000/ - I have cors and csrf configured in
payload.config.ts, and set to the correct.envvariable - I have tried the
/api/users?where[id][equals]=${encodeURIComponent('me')}endpoint which returns the following
{
docs: [],
totalDocs: 0,
limit: 10,
totalPages: 1,
page: 1,
pagingCounter: 1,
hasPrevPage: false,
hasNextPage: false,
prevPage: null,
nextPage: null
}
Any ideas where to go next with this?