-
-
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
feat: add isNewUser
arg on the signIn callback
#8478
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
@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 |
…o reduce code duplication between callbackHandler and checkIfUserIsNew
I have exported the "input validation" lines to an external helper function, because the same thing with the |
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. |
@@ -90,10 +90,17 @@ export default async function callback(params: { | |||
} | |||
|
|||
try { | |||
const isNewUser = await checkIfUserIsNew({ |
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.
This could be stored as let isNewUser = true
on line 81 and set to false
on line 89, couldn't it?
fa96b45
to
65aa467
Compare
isNewUser
arg on the signIn callback
What's going on with this? Will it be merged? |
Please merge this work |
push |
merge when |
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.
LGTM 🫡
Another bump here! Thanks |
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
🎫 Affected issues
Fixes #8272