Azure-Samples / active-directory-b2c-advanced-policies

Sample for use with Azure AD B2C with Custom Policies.
http://aka.ms/aadb2ccustom
MIT License
217 stars 145 forks source link

Connect existing user with external idp #76

Open nataliahering opened 3 years ago

nataliahering commented 3 years ago

I can see that if user eg. someuser@gmail.com has signed up with local sign up, one user will be created in B2C. If then this user signs up with his google social using the same email, another user will be created. Same vice versa. And this is of course expected to happen like that.

How cun I run a custom policy, after the user has entered his email(in case of local sign up) or after google has returned the token(in case of social sign up), see if a user already exists with that email and if yes link the user to the same user id instead of creating a new one? If this is not possible, what I would like instead is to provide a "link"/"connect" functionality to the user, while he is signed in with the one or the other way. For example: User signs in the SPA with username, password someuser@gmail.com -> clicks the "link account" button -> chooses to connect some social -> signs in the social idp -> social profile is connected to initial user. After sign out the user can either sign in with social or with local. Either way it will result to the same profile