feat: add `isNewUser` arg on the signIn callback
This PR implements the isNewUser field on the signIn callback, to allow for the rejection of a potential sign up.
☕️ Reasoning
Sometimes we might want to reject the signIn event if the user doesn't already have an account.
🧢 Checklist
- [x] Documentation
- [ ] Tests
- [x] Ready to be merged
🎫 Affected issues
Fixes #8272
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| auth-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 3, 2023 10:02am |
1 Ignored Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| next-auth-docs | ⬜️ Ignored (Inspect) | Visit Preview | Sep 3, 2023 10:02am |
@kahveciderin is attempting to deploy a commit to the authjs Team on Vercel.
A member of the Team first needs to authorize it.
As far as I understand, the "Credentials" provider is intended to support use cases where one has an existing system one needs to authenticate users against, so a user cannot be a new user when using the Credentials provider, thus I've now added isNewUser: false to the signIn callback when signing in with the credentials provider to reflect that.
I have exported the "input validation" lines to an external helper function, because the same thing with the callbackHandler was being validated in the new checkIfUserIsNew function. Also, I simplified the checkIfUserIsNew function's logic by first checking the email no matter what provider is used, and it checks if the account exists only after establishing that the email doesn't exist and the user is using oauth.
I think I forgot to stage my last changes, will be pushing them now.
This PR should now be ready to merge, would be happy to get some reviews.
What's going on with this? Will it be merged?
Please merge this work
push
merge when
Another bump here! Thanks
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!
To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!