Created
June 18, 2021 16:22
-
-
Save apperside/f0103d281e80867dce8050e2eb43513b to your computer and use it in GitHub Desktop.
next-auth force linking oauth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- node_modules/next-auth/dist/server/lib/callback-handler.js 2021-06-18 18:16:02.000000000 +0200 | |
+++ patches/next-auth/dist/server/lib/callback-handler.js 2021-06-18 18:20:41.000000000 +0200 | |
@@ -150,6 +150,11 @@ | |
if (userByEmail) { | |
// throw new _errors.AccountNotLinkedError(); | |
+ /** | |
+ * If found by email, link user. | |
+ * THIS IS NOT SAFE as stated here https://github.com/nextauthjs/next-auth/pull/1002 | |
+ * but improves user experience | |
+ */ | |
await linkAccount(userByEmail.id, providerAccount.provider, providerAccount.type, providerAccount.id, providerAccount.refreshToken, providerAccount.accessToken, providerAccount.accessTokenExpires); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment