Replies: 9 comments
-
How is this handled with other providers which allow multiple users with one email? Or is this the first of its kind? If it is indeed the first of its kind might be worth having a discussion how to address it moving forward. Can see a few scenarios:
We could also make the above a configuration setting when defining the provider |
Beta Was this translation helpful? Give feedback.
-
I should mention, email addresses are optional on Twitch. i've had users sign up with an empty email address and oauth would error, so i had to make emails default nullable in the prisma schema, and non unique this could be accounted for too with this issue? |
Beta Was this translation helpful? Give feedback.
-
Looking at the prisma docs it seems like a |
Beta Was this translation helpful? Give feedback.
-
yeah i agree, just wanted to point out that currently prisma assumes emails are unique: https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-prisma/prisma/schema.prisma#L13 so this will error for people wanting to use this in the future |
Beta Was this translation helpful? Give feedback.
-
also keep in mind, even if we have multiple Account objects for 1 |
Beta Was this translation helpful? Give feedback.
-
for this specific error maybe its my fault for having userId unique constraint on the Account schema. i see the prisma schema does not have unique on userId in Account. ill try without it and see what happens |
Beta Was this translation helpful? Give feedback.
-
yeah once removing the unique constraint it's working now to save multiple accounts. but the username / image does not match the new account |
Beta Was this translation helpful? Give feedback.
-
Currently, we assume that emails are the same for all accounts that are connected to a single user. Actually, the author of next-auth/packages/core/src/lib/callback-handler.ts Lines 161 to 179 in 3539a35 As such, this is currently expected behavior, so I'll convert this to a feature request for now, so the discussion can go on there. |
Beta Was this translation helpful? Give feedback.
-
any update here? anyone else need this featuer? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Adapter type
@next-auth/prisma-adapter
Environment
https://github.com/dotabod/frontend/blob/master/package.json
Reproduction URL
https://github.com/dotabod/frontend/blob/master/prisma/schema.prisma
Describe the issue
as you can see, twitch allows multiple users with the same email address. so prisma adapter his to be updated to allow multiple linked accounts with same email
linkAccount: (data) => p.account.create({ data }),
How to reproduce
create two twitch accounts with same email address
sign in to your prisma twitch provider website with both accounts
only the first account will be created, the second one will be errored
Expected behavior
allow both accounts to be logged in with separate user ids? not sure if it shoudl link them or make new acts
tried
allowDangerousEmailAccountLinking: true
but did not change anything except bypass the first issue of this:error=OAuthAccountNotLinked
Beta Was this translation helpful? Give feedback.
All reactions