Implement R-GCIP Token-Only Session via ExchangeToken #15041
Merged
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 introduces support for a "token-only" session mode, primarily for Bring Your Own CIAM (BYO-CIAM) use cases with Regionalized GCIP (R-GCIP). This allows developers to use Firebase services with a Firebase token obtained from a third-party OIDC provider, without creating a
Userentity or a standard Firebase Auth session.Key Changes
Auth.exchangeToken): AddsexchangeToken(idToken:idpConfigId:completion:)and itsasynccounterpart. This method exchanges a third-party OIDC ID token for a Firebase ID token._rGCIPFirebaseToken, has been added to theAuthclass to store the token returned fromexchangeToken. This state is mutually exclusive withcurrentUser.AuthInteropModification: ThegetToken(forcingRefresh:completion:)method in theAuthInteropextension has been updated. It now first checks for an active R-GCIP token session.forceRefreshis true, anAuthErrorCode.userTokenExpirederror is returned, signaling that the developer must callexchangeTokenagain.currentUser.signInWithEmail:password:) now clear the R-GCIP token session to prevent conflicting states.ExchangeTokenRequestTests.swift, to validate the URL construction and body of the new API request. UpdatedAuthTests.swiftto cover the newAuthInteroplogic paths.Changelog
Auth.exchangeToken(idToken:idpConfigId:completion:)R-GCIP sessions by exchanging a third-party OIDC token for a Firebase token.AuthInteropprotocol now supports a token-only authentication state, which is activated by a successfulexchangeTokencall.