diff --git a/.changeset/fair-lobsters-teach.md b/.changeset/fair-lobsters-teach.md new file mode 100644 index 0000000..10d24a5 --- /dev/null +++ b/.changeset/fair-lobsters-teach.md @@ -0,0 +1,5 @@ +--- +"payload-auth-plugin": patch +--- + +Allow existing users to sign in and link via OAuth by returning the existing user record instead of null in \_createUser. diff --git a/src/core/protocols/oauth/oauth_authentication.ts b/src/core/protocols/oauth/oauth_authentication.ts index 8ae77f3..4556974 100644 --- a/src/core/protocols/oauth/oauth_authentication.ts +++ b/src/core/protocols/oauth/oauth_authentication.ts @@ -51,9 +51,8 @@ async function _createUser({ email, name, collections, request, allowOAuthAutoSi data, returning: true }) - } else { - return null - } + } + return userRecord } export async function OAuthAuthentication(