Skip to content

Commit

Permalink
Merge pull request #123 from formbricks/fix/users-without-accounts
Browse files Browse the repository at this point in the history
fix: creates account for the user without account
  • Loading branch information
jobenjada authored Oct 1, 2024
2 parents 53f97f9 + b1df423 commit 3d5837a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export const authOptions: NextAuthOptions = {
});

if (existingUserWithAccount) {

if (!existingUserWithAccount.account) {
const { refresh_token_expires_in, ...accountInput } = account;
await createAccount({ ...accountInput, userId: existingUserWithAccount.id });
}

// User with this provider found
// check if email & metadata is still the same
if (
Expand Down

0 comments on commit 3d5837a

Please sign in to comment.