Vendure Auth Token Not Displayed in Browser But Available in Postman #10585
Replies: 1 comment
-
Are you doing this GQL mutation from the browser? or from a Remix action? If you do it from the action, then you need to grab the set-cookie from the GQL response and add that header to the response sent to the browser I recommend you to make your API not use cookies, and instead use the Authorization header with a token. Cookies are a browser feature, APIs can be consumed from browsers, from mobile apps, desktop apps, another server, etc. Another thing, regarding this code: apiOptions: {
cors: {
origin: 'http://localhost:3000',
credentials: true,
},
} If this is server-side, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone! 👋
I'm currently working on a Vendure-based project and have encountered an issue related to authentication.
When I perform a login mutation in Postman, I can see the
Set-Cookie
header and thesessionToken
is properly returned and stored. However, when I try the same login mutation from the browser (GraphQL Playground or from a frontend app), the token is not returned or stored, and I remain unauthenticated for further requests.What I’ve tried so far:
Confirmed login mutation works in Postman:
Checked DevTools > Network in browser:
Set-Cookie
header is not present in the response.Set
credentials: 'include'
in frontend fetch and Apollo client config:Updated
vendure-config.ts
with CORS settings:Questions:
SameSite
or browser cookie policies affecting this?Any help or suggestions from the community would be greatly appreciated 🙏
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions