-
Notifications
You must be signed in to change notification settings - Fork 211
Incorrect emailVerified Status Returned as false for Microsoft Provider in functions.auth.user().onCreate() #1592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @AmilKey. Does this happen with Microsoft provider only, or any others? |
with Microsoft provider only |
I'm noticing this same behavior when using the Firebase Authentication JS SDK. The reason it is an issue in our case is because the automatic account linking of multiple providers does not work for Microsoft. In the Firebase console for our project under the Authentication > Settings > User account linking section we have the "Link accounts that use the same email" setting enabled. This works properly for the Google and Email Link sign-in methods but not for Microsoft which returns the error |
Reproduced this issue. With Google authentication, |
For now, you could use and deploy something like the following function: import {
beforeUserSignedIn,
} from "firebase-functions/v2/identity";
export const beforeSignIn2 = beforeUserSignedIn((event) => {
if (!event.data?.providerData) return;
for (const provider of event.data?.providerData) {
if (provider?.providerId === "microsoft.com") {
return {
emailVerified: true
};
}
}
}); |
Related issues
I did not find any related issues that address this specific problem.
[REQUIRED] Version info
node: v18.20.3
firebase-functions: 5.0.1
firebase-tools: 13.11.2
firebase-admin: 12.2.0
[REQUIRED] Test case
I have a Firebase Cloud Function that triggers on user creation (functions.auth.user().onCreate()). When a user registers using the Microsoft authentication provider, the emailVerified field is returned as false in the user object, even though the Microsoft account has a verified email.
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
The emailVerified field should be true when the user registers using the Microsoft provider, as the email is verified by Microsoft during their authentication process.
[REQUIRED] Actual behavior
The emailVerified field is returned as false for users registering with the Microsoft provider, even though the email should be considered verified by Microsoft.
result User into hook
Note: Locally in the emulator, this works as expected, and the emailVerified field is set to true.
Were you able to successfully deploy your functions?
Yes, the functions deploy successfully without any errors.
The text was updated successfully, but these errors were encountered: