firebase-admin-node
firebase-admin-node copied to clipboard
firebase-auth updateUser with providerToLink using "password" as providerId
Hey I'm trying to link providerData with providerId = "password" using firebase admin SDK
environment :
- Firebase SDK version: 10.0.2
- Firebase Product: auth
- Node.js version: 16.13.0
- NPM version: 8.1.0
The problem I'm trying to link providerData using firebase admin SDK in order to link providerData with providerId = "password" . I'm using updateUser method and pass providerToLink object in order to link providerData. updateUser method will return this error :
- code : auth/invalid-provider-id
- message : The providerId must be a valid supported provider identifier string.
Relevant Code:
await admin
.auth()
.updateUser(user.uid, {
providerToLink: {
uid: user.email,
email: user.email,
displayName: user.displayName,
providerId: 'password',
},
})
.catch((error: any) => {
console.error(`${error}`);
});
If I understand correctly providerToLink is used when you want to link a user to a specific provider, such as google.com. If you want to set a password to a user you should be able to set it in the updateUser payload. I may have misunderstood your requirement here. Adding @prameshj for more context.
The list of valid provider ids can be found by invoking this API call - https://cloud.google.com/identity-platform/docs/reference/rest/v2/defaultSupportedIdps/list
In this case, is a password change being attempted?
Have you found the answer?
I don't think you can link a password provider directly. You could just call updateUser with the email you want (and the password when you know it).
That's odd because you can unlink a password provider.