Next.js Discord

Discord Forum

the key is returning undefined when i try to create a jwt

Answered
subscr posted this in #help-forum
Open in Discord
Answered by James4u
oh I see so it should be session.profile.id instead of session.user.id
View full answer

32 Replies

probably because the session took a long time to load and was already direct to useEffect.
@subscr you created a new one - was replying in the previous one
sorry I didn't see your code deeply
so couple of bugs there
so first of all add session to the dependency array of your useEffect
@James4u <@1053131637187149905> you created a new one - was replying in the previous one
sorry, i thought that, that topic has already been solved another problem, to get more organized I created this
and in your useEffect check session?.user?.id and return; before making axios call
like this?
yeah, exactly
now nothing happens, apparently it stops at the if(!token) return null
first of all see your backend console if you are getting correct api request
lol
session.user.id = undefined
session.profile.id = id
lmao
@subscr
not much following you
plz be clear at your communication as I am not familar with your codebase
@James4u plz be clear at your communication as I am not familar with your codebase
basically, user.id returns undefined and profile.id returns the user id
oh I see so it should be session.profile.id instead of session.user.id
Answer
sorry anything, I don't speak English very well, I'm using google translator
no worries
so is everything working fine?
@James4u oh I see so it should be session.profile.id instead of session.user.id
yes, I switched and it worked, incredible as it may seem
i will mark as resolved, thank you again!
sure then close this thread
@James4u sure then close this thread
oh, ok
Original message was deleted
🙂