-
Bug ReportI'm currently logging in on a collection using graphql. Right now the collection setup looks like this.
I'm using an Authorization header on the graphql requests that looks like
Using the token that I got back from logging in via graphql. When testing it in the graphql playground I'm getting null response on token and user. It seems like req.user is null when I debug the {
"data": {
"mePublicUser": {
"token": null,
"user": null
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
After some digging I thought it had to do with the response cookie not being set from the server, since I hadn't configured auth: {
cookies: {
secure: true,
sameSite: 'none'
}
}, I now see the cookie |
Beta Was this translation helpful? Give feedback.
-
HEy @itzaks — Couple clarifying things for ya quick: I believe you should only need to specify But if you are specifying the Anyway, that's just background info. I just tried to recreate your issue on the Payload demo (https://demo.payloadcms.com/api/graphql-playground) but I can't. I even used Postman to run a I expect something else is amiss here, and it's just a small issue with your setup. If you can create a minimally reproducible repo, I am happy to help diagnose further! Let's keep the convo going in a discussion. |
Beta Was this translation helpful? Give feedback.
-
Related: #1902 |
Beta Was this translation helpful? Give feedback.
HEy @itzaks —
Couple clarifying things for ya quick:
I believe you should only need to specify
credentials: 'include'
on fetches if you are relying on Payload's HTTP-only cookie to authenticate.But if you are specifying the
Authorization
header directly, that will override the HTTP cookie. So it seems to me like you might be trying to do both here.Anyway, that's just background info.
I just tried to recreate your issue on the Payload demo (https://demo.payloadcms.com/api/graphql-playground) but I can't. I even used Postman to run a
meUser
directly from the demo's GraphQL endpoint.I expect something else is amiss here, and it's just a small issue with your setup. If you can create a min…