Auth0 Home Blog Docs

Create auth0 user with same email but different provider

Howdy -

I was wondering if there was a force create account option in auth0 user api to allow the creation of a new auth0 user with same email as another one but different connection/provider.

We are running into a use case where the user wants to delink their primary auth0 user - in this example it’s a social connection, if they want to do this we’re making them input a password to create a email/password user (connection would be auth0 instead of the social). If the user decides to change their email, the flow works fine. If the user wants to keep the same email with their new auth0 email/pw account the api returns an error.

What api are you calling and what error is it returning? Any more details such as code snippets, error logs would be helpful to give you some suggestion

This is the payload:

                email: email,
                password: password,
                connection: auth0Conf.connection,
                email_verified: true,
                verify_email: false

the endpoint is just user create -> POST, api/v2/users

and the API returns what error?

this is the api error:

    "statusCode": 409,
    "error": "Conflict",
    "message": "The user already exists.",
    "errorCode": "auth0_idp_error"

so the primary user is with social connection and secondary user is with auth0 database? when you delink there will be two separate users with the same email but two separate connections. This means creating yet another user with different email and auth0 strategy will work (and it already dos as you mentioned) but creating a new user with same email and auth0 database connection will fail because due to de-linking there is already a user with same email and auth0 strategy. Does that make sense?

@ashish no this is not linking accounts. this is creating a new standalone account that’s different, without linking. we want two auth0 standalone users. it doesn’t make sense to have to go through linking and delinking to create a user with a different connection, it would get a totally different auth0 user_id even though the email matches.