Hi Nikita Gr8 Article ... but Express can't write token'cookie !
this line of code seems ok : "res.cookie('token', jwt, { httpOnly: true });" in auth.resolver.ts,
and the token is correctly generated but no cookie is created in client side...
P.S. If you are not using graphql playground and calling the server from a front-end application served from another server (different domain/port/etc.) you need to enable cors on the nestjs server (not described in the article). To do it simply add these lines to your main.ts file to the bootstrap function.
Hi Nikita Gr8 Article ... but Express can't write token'cookie !
this line of code seems ok : "res.cookie('token', jwt, { httpOnly: true });" in auth.resolver.ts,
and the token is correctly generated but no cookie is created in client side...
Please check your graphql playground settings in the browser. You should have
"request.credentials": "same-origin"
set there to allow CORS.Indeed, that works
P.S. If you are not using graphql playground and calling the server from a front-end application served from another server (different domain/port/etc.) you need to enable cors on the nestjs server (not described in the article). To do it simply add these lines to your main.ts file to the bootstrap function.
Cors was the problem yes, thanks again for these speed responses !