Empty Object Returned When Retrieving Session in Next Auth Deployment
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
What could be the possible reason why I got an empty object when getting my session in Next Auth? It works fine locally, but the issue occurs when I deploy it.
27 Replies
what do you mean by empty object?
const obj = {}
not null or undefined?
const obj = {}
not null or undefined?
Asiatic LionOP
this is from my deployed website
in my localhost:
do u see a JWT token in cptnokyc.com?
Asiatic LionOP
my session token is does not exist on the deployed version
maybe because i did not set my NEXTAUTH_URL? i used app directory @tafutada777
where do you host? Vercel or others?
Asiatic LionOP
vercel
@Asiatic Lion my session token is does not exist on the deployed version
Asiatic LionOP
when i signed in
then u do not need it
oh
@Asiatic Lion when i signed in
Asiatic LionOP
i think this is the reason
you need to change the cookie names
Asiatic LionOP
ohh wait let me try it
someone asked me the same question before
Asiatic LionOP
can you send me the link, thank you so much, i spent almost 24hrs debugging this
u mean how to change the cookie names of next-auth?
Asiatic LionOP
i fixed it!!
congrats!
Asiatic LionOP
but i don't know if it correct because i make the useSecureCookies to false
Asiatic LionOP
__Secure-next-auth.session-token to next-auth.session-token
ohh alright, i try to change the sessionToken name
Thank you so much!! @tafutada777
np sleep well
Blanc de Hotot
@Asiatic Lion Looks like this was solved, congrats! You should consider marking this post as answered (
Right click -> Apps -> Mark Solution) to help others that might have the same problem.I guess the question is also considered the answer to itself huh