Skip to content

Comments

Update ParsedToken Types#9588

Open
cdgco wants to merge 2 commits intofirebase:mainfrom
cdgco:idToken-claim-typing
Open

Update ParsedToken Types#9588
cdgco wants to merge 2 commits intofirebase:mainfrom
cdgco:idToken-claim-typing

Conversation

@cdgco
Copy link

@cdgco cdgco commented Feb 24, 2026

Update the public types for ParsedToken to better match the GCIP claims. A good example of the full token can be seen in the docs Securing your app with signed headers:

{
    "auth_time": 1553219869,
    "email": "[email protected]",
    "email_verified": true,
    "firebase": {
      "identities": {
        "email": [
          "[email protected]"
        ],
        "saml.myProvider": [
          "[email protected]"
        ]
      },
      "sign_in_attributes": {
        "firstname": "John",
        "group": "test group",
        "role": "admin",
        "lastname": "Doe"
      },
      "sign_in_provider": "saml.myProvider",
      "tenant": "my_tenant_id"
    },
    "sub": "gZG0yELPypZElTmAT9I55prjHg63"
  }

This revises the type for identities, changing it from a string to an array of strings (resolves #7591), and adds types for email, email_verified, firebase.sign_in_attributes, and firebase.tenant.

sign_in_attributes is set as unknown since that can be set to any value by the identity provider (see Signing in users with SAML).

@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: 70e36f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/auth Patch
@firebase/auth-compat Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @cdgco, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the ParsedToken interface and its corresponding documentation to accurately reflect the structure of tokens issued by Google Cloud Identity Platform. The changes ensure that developers have precise type definitions for common and custom claims, enhancing type safety and improving the developer experience when accessing token data by aligning the types with the latest GCIP claim specifications.

Highlights

  • ParsedToken Type Updates: Updated the 'ParsedToken' interface to align with Google Cloud Identity Platform (GCIP) claims, introducing new fields and refining existing ones.
  • Revised 'identities' Field Type: The type of the 'identities' field within the 'firebase' object was changed from 'Record<string, string>' to 'Record<string, string[]>' to correctly represent multiple identities.
  • New Top-Level 'ParsedToken' Fields: Added 'email' (string) and 'email_verified' (boolean) properties directly to the 'ParsedToken' interface.
  • New 'firebase' Sub-Fields: Introduced 'sign_in_attributes' (Record<string, unknown>) and 'tenant' (string) within the 'firebase' object of 'ParsedToken'.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • common/api-review/auth.api.md
    • Added 'email' and 'email_verified' properties to the 'ParsedToken' interface.
    • Updated the type of 'firebase.identities' to 'Record<string, string[]>' from 'Record<string, string>'.
    • Added 'firebase.sign_in_attributes' and 'firebase.tenant' properties.
  • docs-devsite/auth.parsedtoken.md
    • Updated the table of properties for 'ParsedToken' to include 'email' and 'email_verified'.
    • Updated the 'firebase' property description to reflect new sub-properties and type changes.
    • Added detailed documentation sections for 'ParsedToken.email' and 'ParsedToken.email_verified'.
    • Updated the 'firebase' property signature to include 'sign_in_attributes', 'identities' (with new type), and 'tenant'.
  • packages/auth/src/model/public_types.ts
    • Added 'email' and 'email_verified' properties with JSDoc comments to the 'ParsedToken' interface.
    • Updated the type of 'firebase.identities' to 'Record<string, string[]>' from 'Record<string, string>'.
    • Added 'firebase.sign_in_attributes' and 'firebase.tenant' properties to the 'firebase' object.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ParsedToken types to better align with GCIP claims, which is a great improvement. The changes look good and correctly reflect the example token provided. I've added one suggestion to improve maintainability by sorting the interface properties. Additionally, please consider updating the types for auth_time, exp, and iat from string to number to align with the JWT specification and the example provided. This would improve type safety but may require updates in other parts of the code.

@cdgco cdgco requested review from a team as code owners February 24, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ParsedToken identities is not of record<string, string> type

1 participant