Replies: 17 comments 25 replies
-
Ok I just found the answer in the section: |
Beta Was this translation helpful? Give feedback.
-
However, the error text is not clear for the end user: he might have forgotten which account he used to subscribe. Also the provider could be added in a pending state. The user can then connect with his 'original account' then confirm he owns that secondary account too. |
Beta Was this translation helpful? Give feedback.
-
For accounts to be linked together securely, you have to be logged in with an account with the same email while linking the new account. it's a design choice, outlined in https://next-auth.js.org/faq#security we don't intend to chnahe this behavior, but we plan to make it easier to implement account linking in the future |
Beta Was this translation helpful? Give feedback.
-
I saw that, and I closed the issue before reopening it to say the error message is user unfriendly, since it doesn't tell which provider he signed in with, and the provider can be put in a 'pending' state until it is validated by the user (logged in regularly). |
Beta Was this translation helpful? Give feedback.
-
I mean they just clicked the "sign in with..." button, no? 🤷♂️ And we cannot leak which other providers that email address is associated with. |
Beta Was this translation helpful? Give feedback.
-
I think this can be subject to discussion, knowing that some email that ends with @gmail.com is a Google account :-) (or simply exists) is a risk some businesses might be ready to take in exchange of their users churning less because it's easier to sign in. Finally, I think a company could allow its users to reveal this type of info or not in their security settings. What are your thoughts? |
Beta Was this translation helpful? Give feedback.
-
I've noticed one issue with multi-provider flows:
|
Beta Was this translation helpful? Give feedback.
-
Linking accounts while someone is logged in really makes no sense at all. I will gladly put on my best Winston Churchill impression and carry the troops to victory on this one. What do we need to do to get this done? Is it really impossible to not be able to auto link accounts? For me, this makes reconsider using nextauth @mohammed-bahumaish @balazsorban44 @ziedHamdi @lienista |
Beta Was this translation helpful? Give feedback.
-
I suggested that the library can propose an opt-out from this restriction if they consider defaults must have this security constraint. Even if they consider it is important, each company is responsible for their own security implementation, so they should decide whether they want that. Besides that, I cannot understand where is the danger: a person who created an OAuth account with gmail, loggs out, then tries to login with facebook. What could happen? if a hacker created a facebook account with that same email, he could not login to facebook as long as he doesn't click on a link in his mails to prove he really owns that mail. Sure, we rely on facebook, twitter or other providers to verify the person really owns that email. But is it really a risk? I mean my example.com app would not trust facebook, twitter or other providers and would want to verify itself that the user is really logged in, and has access to that mail? We know he has access to it since he subscribed through a provider that checked that for us. Last point, to show how illogical it seems to me: We can put a provider in a PENDING state and send a mail to the user to verify he really owns it (and therefore, he owns that account he's trying to link). But wait, we should already know he has access to that mail, since we logged him in with another provider using that same mail. In other words: should we recheck he has access to the mail each time he links an additional account with that same mail??? @DZuz14 I'd love to help you on that, but I'm launching weally.org and getting very busy with making it widely adopted |
Beta Was this translation helpful? Give feedback.
-
I undrestand the it is better for the user to be loggedIn when he links accounts example: If the same person had logged out, before relogging with facebook. He would have two accounts. And now if one of the accounts (eg. the one logged with facebook) tries to link the other account (the one created with LinkedIn Auth), he would get an error (user already exists) Merging the two accounts is a lot of work, as all contributions should change userId to one of the two previous. However! if the user now wants to log in with Twitter, and that account is linked to a@mail.com, the platform forbids him to enter. From the user perspective, it is a mess: why was he able to create two accounts by logging with LinkedIn and facebook, and now he cannot even enter the platform? (for consistency: the platform should either create him a third account, or log him with the LinkedIn one. Understanding why the platform refuses him is hard to 'debug' for him as a user) |
Beta Was this translation helpful? Give feedback.
-
@ziedHamdi @andrewgbliss So taking what zied has said into account, is something like the following a suitable flow for a user?
I see a minor flaw with this, as you'll receive this message for every OAuth provider that you haven't received a verification email for. That might be annoying, but would probably be mitigated due to the fact that the sessions don't expire as long as the user is using the app, and users aren't likely to have to sign in again. The other case of a user already being logged in with an OAuth provider and signing with another one is already handled by the library. However, I have no clue why you would want to allow access to the sign in page when a user is logged in, that is confusing. In my app, I do a server side redirect on the sign in page if it detects their is a session, and redirects to the home page. |
Beta Was this translation helpful? Give feedback.
-
Is there a way I can hook into the linkAccount code and write the link logic myself? It should just be an easy lookup, does email match. I don't understand the complex discussion. |
Beta Was this translation helpful? Give feedback.
-
I want to call out that you can also use Doing this should solve most of the errors around account linking. Now if you use a 3rd party providers that you do not trust, you can probably handle the logic yourself. I think if |
Beta Was this translation helpful? Give feedback.
-
What is the current behaviour? I signed up using Google oauth. Signed out. Then tried via Email magic link. It allows me to login into the same account. I didn't change any configuration. |
Beta Was this translation helpful? Give feedback.
-
Hey everyone! Just FYI – NextAuth now has automatic account linking! All you need to do is specify the |
Beta Was this translation helpful? Give feedback.
-
This discussion is really intersting! |
Beta Was this translation helpful? Give feedback.
-
Hello, I want to store info from each provider that is relevant to my application. I used a custom adapter, and I extend the Now I want to use multiple providers:
The problem is that I don't see any documentation on how to extend the linking process to also grab the data from the provider.
rawAccount doesn't contain anything relevant, and I don't know any other method that may serve me, where is the linking by email being performed? Alternatively I can do this through the signIn callback and check every time someone logs in if the data is already stored, but it would be more a hack than a proper solution, Any idea? |
Beta Was this translation helpful? Give feedback.
-
Description 📓
When a user signs in from two OAuth providers where he used the same mail to subscribe (e.g. a Facebook account using a Google Mail): The user can't sign in with both accounts: as soon as he subscribed with one of them, he will get a user error when attempting to connect with the second: "To confirm your identity, sign in with the same account you used originally."
If the app proposes many providers, the situation is uncomfortable for the user : he might have forgotten with which provider he subscribed initially. (see image)
Where the user may have forgotten which provider he previously used to subscribe (especially if more than two providers are available, unlike in the picture)
)
The actual behavior is justified by the following document: https://next-auth.js.org/faq#security.
What could be done? ☕️
There should be a possibility for apps to highlight which account provider was originally used to subscribe. Some other apps may consider that information as sensible information and want to keep the current behavior.
To satisfy both use cases, there could be a boolean parameter in the configuration file activating the provider_highlight
Furthermore, the current error message could be replaced with a feature consisting of a two phase validation: on an attempt to connect with a different provider (using the same mail) the following could happen:
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
Beta Was this translation helpful? Give feedback.
All reactions