Skip to content

v2 Functions Auth Context does not carry tenant information when using Identity Platform #1574

Open
@arndtvoges

Description

@arndtvoges

[REQUIRED] Version info

node:
20.14.0

firebase-functions:
5.0.1

firebase-tools:
13.11.2

firebase-admin:
12.1.1

[REQUIRED] Test case

See below

[REQUIRED] Steps to reproduce

  1. Create a Firebase v2 Function with Auth Context that listens to a document
import { onDocumentCreatedWithAuthContext } from "firebase-functions/v2/firestore"

exports.syncUser = onDocumentCreatedWithAuthContext("users/{userId}", (event) => {
   const { authType, authId } = event; // These are the only two strings related to auth and do not contain tenant information
   console.log(authType, authId};
}); 
  1. Authenticate client-side as a tentant-scoped user via Identify Platform
  2. Observe that auth context (as documented here) is not tenant aware.

[REQUIRED] Expected behavior

Tenant id should be in Auth Context of v2 Functions. This seems to be a regression from v1 Functions where the tenantId is carried in context.

[REQUIRED] Actual behavior

Auth Context of v2 Functions does not carry tenant information. This makes it impossible to access a tenant-scoped user's information unless tenantId is tracked outside of the auth stack because Firebase Auth is tenant specific and requires to be initiated with tenantId.

Were you able to successfully deploy your functions?

Yes

Activity

google-oss-bot

google-oss-bot commented on Jun 11, 2024

@google-oss-bot
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.
arndtvoges

arndtvoges commented on Jun 12, 2024

@arndtvoges
Author
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

My bad, the missing section should be there now.

moved this from Needs Triage to Ready for Development in [Cloud] Extensions + Functionson May 1, 2025
moved this from Ready for Development to Triaged in [Cloud] Extensions + Functionson May 1, 2025
moved this from Triaged to Needs Triage in [Cloud] Extensions + Functionson May 1, 2025
moved this from Needs Triage to Triaged in [Cloud] Extensions + Functionson May 1, 2025
moved this from Triaged to Needs Triage in [Cloud] Extensions + Functionson May 1, 2025
moved this from Needs Triage to Triaged in [Cloud] Extensions + Functionson May 1, 2025
moved this from Triaged to Needs Triage in [Cloud] Extensions + Functionson May 1, 2025
moved this from Needs Triage to Triaged in [Cloud] Extensions + Functionson May 1, 2025
added and removed on May 1, 2025
moved this from Triaged to Needs Triage in [Cloud] Extensions + Functionson May 1, 2025
moved this from Needs Acknowledgment to Triaged in [Cloud] Extensions + Functionson May 7, 2025
moved this from [old] Triaged to Opened in [Cloud] Extensions + Functionson Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @arndtvoges@google-oss-bot@cabljac@exaby73

        Issue actions

          v2 Functions Auth Context does not carry tenant information when using Identity Platform · Issue #1574 · firebase/firebase-functions