-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Include profile on signIn events #2354
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/21ReaC5QHseqMTWtcGsxN39LMtmP |
Thank you for the PR! I guess it's a legit change, but I'm curious if you need this change because adapters currently only save a few fields in the database on sign-in? In that case, this might be relevant https://github.com/nextauthjs/adapters/issues/151 In v4, we will try to make it easier to save anything on the User model and document on how to change your DB schema to support that. This PR is still fine I think, but hopefully your usecase can be handled more easily in the future. Question is if you would be fine waiting until v4 with this change anyway, because the internal events invocations did recently change on the We are close to a major release (hopefully this summer) and didn't expect many PRs changing core stuff, so we didn't change the CONTRIBUTING.md either. 🤔 |
@balazsorban44 ty so much for the quick reply! That issue is also very much within my interests 👀 Storing custom fields would be helpful, but would likely put us in a place of "stale data" pretty quick (i.e. user changes display name on Twitch) This solution has been the quickest I've found thusfar. Resulting UX is super clean too IMO - just "re-auth" to update your name. I have a video demo here: |
Oh also - I am using this change right now via |
Saw the demo, nice! I think this is a fine addition no matter the reason behind it, so if it's fine by you and you could do this against |
Tried switching base branch on this one and it was a mess (looks like the event callback pattern changed, I prefer the new one though 😄 ) New PR here: #2356 |
profile
added toevent.signIn
messageReasoning 💡
I use the profile information to fire updates on the user object after any successful sign-in. Before this change, I had to stuff handlers to sync
profile.name
andplatform
against theUser
model in 3 separate places. This change allows me to have a complete "source of truth" within thesignIn
event :)Checklist 🧢
To check an item, place an
x
in the box like so:- [x] Documentation
. -->I would like some thoughts from the team on this solution before cleanup + merge. I am happy to make any docs changes and add tests if this is a solution y'all are happy with :)
Affected issues 🎟
Didn't file one, went straight to source :)