Skip to content

Missing details in the AuthBlockingEvent when using with the Authentication Emulator #8109

Closed

Description

@vajahath

[REQUIRED] Environment info

firebase-tools: 13.29.1

Platform: MacOS

[REQUIRED] Test case

This seem to be the Auth emulator bug.

export const onUserSignIn = beforeUserSignedIn(async (event) => {
  const providerData = event.data?.providerData;
  const providerId = event.additionalUserInfo?.providerId;
  const isNewUser = event.additionalUserInfo?.isNewUser;
  const metadata = event.data?.metadata;
  
 console.log(JSON.stringify({providerData, providerId, isNewUser, metadata}));
});

Output:

{
  "providerData": [],
  "providerId": "google.com",
  "isNewUser": false,
  "metadata": {
    "creationTime": "Invalid Date",
    "lastSignInTime": "Invalid Date"
  }
}

[REQUIRED] Steps to reproduce

  • I anonymously signed in the user
  • Then I converted the user to google signed in user.
export const onUserSignIn = beforeUserSignedIn(async (event) => {
  const providerData = event.data?.providerData;
  const providerId = event.additionalUserInfo?.providerId;
  const isNewUser = event.additionalUserInfo?.isNewUser;
  const metadata = event.data?.metadata;
  
 console.log(JSON.stringify({providerData, providerId, isNewUser, metadata}));
});

[REQUIRED] Expected behavior

  1. providerData shouldn't be empty (see providerId, so that information seem missing in providerData)
  2. creationTime and lastSignInTime are invalid - it should be actual Date.

[REQUIRED] Actual behavior

{
  "providerData": [],
  "providerId": "google.com",
  "isNewUser": false,
  "metadata": {
    "creationTime": "Invalid Date",
    "lastSignInTime": "Invalid Date"
  }
}

Activity

  1. colerogers commented on Jan 16, 2025

    @colerogers
    Contributor

    Hey @vajahath thanks for opening this issue!

    I did some digging and it looks like the provider data isn't being sent from Auth emulator and both the creationTime and lastSignInTime being sent are string representations of milliseconds since Epoch. In the Functions SDK we convert these times using new Date() here. Since those are treated as strings and not numbers, the output is Invalid Date. The Auth emulator needs to be patched to correctly send them as numbers so the SDK can parse them. I'll re-assign this issue so they can take a look.

  2. self-assigned this
    on Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions