-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create backend user when generate jwt #2702
Conversation
} | ||
|
||
// TODO avoid duplicate logic with the signIn event | ||
if (frontendUser.isNew && !frontendUser.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already create a username in line 143?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to ensure everything still works, since we have no test for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I still don't see which edge case is being caught here, or why are we checking for the name in line 140? we had the same sign up process for ever, did anything regarding the sign up requirement change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how next auth work internally, but it seem the jwt
callback is called before the signIn
event, so in that case the name is not available yet, but the backend requires a name so I have to assign it first. The check !user.name
on line 140 is to make sure we don't assign the name again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I see, can you please comment that in the code, so we know why we did this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Avoid flooding the backend log with user not found error