fix(auth): fix token signing service account email extraction#184
Open
lahirumaramba wants to merge 1 commit intoinvertase:nextfrom
Open
fix(auth): fix token signing service account email extraction#184lahirumaramba wants to merge 1 commit intoinvertase:nextfrom
lahirumaramba wants to merge 1 commit intoinvertase:nextfrom
Conversation
|
|
demolaf
reviewed
Mar 5, 2026
Member
demolaf
left a comment
There was a problem hiding this comment.
Hi @lahirumaramba , thanks for the PR!
We would have to wait for the changes in googleapis_auth to be published or temporarily make the below change until then.
+dependency_overrides:
+ googleapis_auth:
+ git:
+ url: https://github.com/google/googleapis.dart.git
+ ref: master
+ path: googleapis_auth
+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a bug in the Firebase Admin SDK where generating custom tokens or signing bytes failed if the application was initialized using Workload Identity Federation / Application Default Credentials (ADC).
The Issue
Previously, the SDK was attempting to extract the service account email directly from
options.credential?.serviceAccountCredentials?.email. However, when using ADC, theserviceAccountCredentialsproperty is explicitlynull. This resulted in the IAM signing layer lacking the necessary target principal to execute thesignBlobAPI correctly.The Fix
app_extension.dart: Refactored theserviceAccountEmailgetter to rely onoptions.credential?.serviceAccountId(which works for both Standard Service Accounts and ADC).options.credential?.serviceAccountIddirectly to the underlyinggoogleapis_authlibrary'sclient.signmethod, ensuring that token generation requests are properly attributed to the target service account.Note: This PR is dependent on the
googleapis_authlibrary update that introduces theserviceAccountEmailparameter toAuthClientSigningExtension.sign. google/googleapis.dart#731