Hi there, these are the cookies I have in the brow...
# support-questions
f
Hi there, these are the cookies I have in the browser when I'm (supposed to be) signed in. https://prnt.sc/0-c7XPkIYqoh Is this correct? If yes, then why do I get this response on auth/me? https://prnt.sc/s29fUDnToVcg
r
hey @FrAgOrDiE
Can you enable debug logging and show me the log output of this API call?
f
alright so here I'm having troubles aswell: I'm both starting my NestJS project with
DEBUG=com.supertokens npm start
and setting
DEBUG=com.supertokens npm start
into the .env file. And this https://prnt.sc/yfg_qLrNXo-L is the output I get. Just a normal server start without logging
I tried sending API requests to the server, still no logging
r
whcih version of node SDK?
f
"supertokens-node": "^9.1.1"
r
use ^9.1.2
f
ok sweet it works with npm start, can`t I set a debug flag into the code?
because only by setting the variable into .env file doesn't work
r
Right. You have to do it via the env var.
f
It doesn't work like that
as you can see the env variable is taken by node
but no debug logs like this
edit: on windows it doesn't work either way, on linux it works if starting with
DEBUG=com.supertokens npm start
but it doesn't if I start with
npm start
and variable into env file
It doesn't particularly matter though. In response to your first question:
The cookies have different domains and maybe that's the issue: I'm investigating on it. Sorry for the confusion
r
yea. you are right. The cookies do have a different domain set.
f
@rp, why then the cookie domain https://prnt.sc/0-c7XPkIYqoh is set to localhost? What changes this?
Same requests on postman set the cookie domain to the API base path
r
these are different cookies than the cookies associated with the API.
These cookies are attached to your frontend app.
It's for the frontend app to know if a session exists or not.
The cookies attached to your API domain are different, and those are for the backend to use during session verification.
f
I get it
Do you have any idea then why auth/me gets "unauthorized"?
r
Can you also send the output logs for when you start the server?
And also how you are querying the API.
f
these are server start logs
r
Are you setting
cookieSecure
to
false
during session.init?
f
/consume seems to attempt set-cookie but cookies are not being set
here the /verify request
yes
on the server, yes
r
what does the orange triangle say next to the set cookie headers?
f
"This Set-Cookie was blocked due to user preferences"
r
Can you remove the
cookieSecure: false
on the backend and try again?
f
this is what we get not by the way
yeah, we`re now trying to deploy on the actual domain / no localhost
r
I mean just remove the cookieSecure flag that you set to false on the backend and it should work
even if you query from localhost, it will work.
f
ahh ok
sweet, it works
thank you
4 Views