Skip to content
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

Incorrect emailVerified Status Returned as false for Microsoft Provider in functions.auth.user().onCreate() #1592

Open
AmilKey opened this issue Aug 14, 2024 · 2 comments

Comments

@AmilKey
Copy link

AmilKey commented Aug 14, 2024

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

  1. Set up Firebase Authentication with Microsoft as a provider.
  2. Create a Cloud Function that triggers on user creation (functions.auth.user().onCreate()).
  3. Register a new user using the Microsoft provider.
  4. Inspect the emailVerified field in the user object within the triggered Cloud Function.

[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

{
  "uid": "BLTZuXMlmxSotyULCIifeenCxE82",
  "email": "test@domain.com",
  "emailVerified": false,
  "displayName": "My Name",
  "photoURL": null,
  "phoneNumber": null,
  "disabled": false,
  "passwordHash": null,
  "passwordSalt": null,
  "tokensValidAfterTime": null,
  "metadata": {
    "creationTime": "2024-08-14T05:55:07Z",
    "lastSignInTime": "2024-08-14T05:55:07Z"
  },
  "customClaims": {},
  "providerData": [
    {
      "displayName": "My Name",
      "email": "test@domain.com",
      "providerId": "microsoft.com",
      "uid": "c0698c11-44b8-41ed-9f2c-8f431484a35e",
      "toJSON": "[Function (anonymous)]"
    }
  ]
}

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.

@exaby73
Copy link
Contributor

exaby73 commented Aug 15, 2024

Hey @AmilKey. Does this happen with Microsoft provider only, or any others?

@exaby73 exaby73 added the Needs: Author Feedback Issues awaiting author feedback label Aug 15, 2024
@AmilKey
Copy link
Author

AmilKey commented Aug 15, 2024

Hey @AmilKey. Does this happen with Microsoft provider only, or any others?

with Microsoft provider only

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants