next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

feat: Add a `linkAccountOverride` method in adapter

Open Khaaz opened this issue 8 months ago • 3 comments

☕️ Reasoning

This allows to better control the authentication flow. Effectively, it exposes a linkAccountOverride method in the adapter.

This method will be triggered through this workflow:

  • a user A is created through signing in with account A
  • a user B is created through signing in with account B
  • connected with account A (and user A), signing in with account B

Actual behaviour:

  • sends back an error saying it is not possible to link an account already linked to a different user

Expected behaviour:

  • Allow to customise what we want to do in this situation

What this PR offers:

  • a method to control what to do in this situation, potentially allowing to link account B to user A

🧢 Checklist

  • [ ] Documentation
  • [ ] Tests
  • [ ] Ready to be merged

🎫 Affected issues

Fixes: https://github.com/nextauthjs/next-auth/issues/9339

📌 Resources

Khaaz avatar Dec 12 '23 22:12 Khaaz

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Feb 12, 2024 5:17pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:17pm

vercel[bot] avatar Dec 12 '23 22:12 vercel[bot]

@Khaaz is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 12 '23 22:12 vercel[bot]

I'll gladly add tests or docs, please let me know if this feature is acceptable first.

I would also love quick guidance on documentation or tests if possible (I'll try to figure it out anyway after confirmation this PR has a future).

Looking forward to any feedback as I definitely need this feature for my usecase.

Thanks a lot.

Khaaz avatar Dec 12 '23 22:12 Khaaz