Skip to content

error auth/account-exists-with-different-credential for a new user without any provider #8371

@AmilKey

Description

@AmilKey

Operating System

Mac OS

Browser Version

Chrome 126

Firebase SDK Version

9.23.0

Firebase SDK Product:

Auth

Describe your project's tooling

Ember.js, Webpack

Describe the problem

In the settings, the "Link accounts that use the same email" option is enabled.

After creating a new user via a server firebase function, a new user is created without any provider. I use this code in the function when sending an invite.
Additionally, my project has several providers enabled, such as the Microsoft provider. After logging in through it, I get the following error: auth/account-exists-with-different-credential As a result, the newly invited user cannot immediately log into the system through any provider.
I expect that I should be able to log into the system through any provider since the user is new and does not have any associated provider.

Steps and code to reproduce issue

admin_function.js

exports.sendInvite = onCall({ secrets: [sendgridApiKey], enforceAppCheck: true }, async ({ data, auth }) => {
   await getAuth().createUser({ email: data.email });
   .....
})

Client App

const instanceProvider = new OAuthProvider('microsoft.com');
instanceProvider.setCustomParameters({ prompt: 'select_account' });
const result = await signInWithPopup(auth, instanceProvider);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions