Repository navigation
feat(auth): Add IdTokenResult and User::GetIdTokenResult support - #1938
Open
AustinBenoit wants to merge 3 commits into
Open
AustinBenoit wants to merge 3 commits into
AustinBenoit wants to merge 3 commits into
Conversation
Implements IdTokenResult struct and User::GetIdTokenResult(bool force_refresh) with token parsing, custom claims extraction, and timestamp decoding. Supports Desktop, Android, and iOS platforms. Adds comprehensive unit tests, doc samples, and release notes.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds the IdTokenResult struct and the User::GetIdTokenResult() method to retrieve decoded ID token claims and metadata across Desktop, Android, and iOS platforms. It also introduces JWT parsing utilities and comprehensive tests. The review feedback suggests explicitly deleting the local JNI reference j_token in the Android implementation to prevent reference table overflow, and logging warnings on Desktop if token parsing fails to assist with debugging.
- Document IdTokenResult equality and inequality operators for Doxygen - Include <map> in id_token_util.cc for IWYU compliance - Delete local JNI reference j_token in ReadIdTokenResult - Log warnings on Desktop if ParseIdToken fails for cached or refreshed tokens - Use PRIu64 with cinttypes in doc_samples.cc instead of casting to unsigned long long - Reformat single-line block in user_desktop_test.cc
…S and move id_token_util to desktop_SRCS
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
Adds
IdTokenResultstruct andUser::GetIdTokenResult(bool force_refresh)to retrieve Firebase Auth ID token details, including standard claims, custom claims (std::map<Variant, Variant>), authentication/issued-at/expiration timestamps, and sign-in provider / second-factor metadata.Key changes:
IdTokenResultstruct andUser::GetIdTokenResult(),User::GetIdTokenResultLastResult(), andUser::GetIdTokenResultThreadSafe()tofirebase/auth/user.h.User::GetIdTokenResultusingEnsureFreshTokenand a JWT payload decoder with URL-safe base64 decoding and JSON parsing intoVariantmaps.User::GetIdTokenResultvia JNI callingFirebaseUser.getIdToken(forceRefresh).User::GetIdTokenResultusing[FIRUser getIDTokenResultWithCompletion:].IdTokenResultTestinauth/tests/id_token_result_test.ccandauth/tests/user_test.cc).auth/samples/src/doc_samples.cc.release_build_files/readme.md.Testing
firebase_authdesktop library locally.firebase_auth_id_token_result_test(12 unit test cases passing, covering valid tokens with standard & custom claims, base64url padding variants, malformed tokens, and equality operators).scripts/format_code.py -git_diff).Type of Change
Place an
xthe applicable box:Notes
Release Notessection ofrelease_build_files/readme.md.