Enable OIDC Token Exchange for BYO-CIAM (R-GCIP) #14983
Open
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 adds new public methods to
Auth
to support exchanging a third-party OIDC ID token for a Firebase ID token. This functionality is essential for the Bring Your Own CIAM (BYO-CIAM) feature, allowing integration with external OIDC providers within a Regionalized GCIP (R-GCIP) setup.New Public API:
struct FirebaseToken: Sendable
: Holds the exchangedtoken
(String) and itsexpirationDate
(Date).Auth.exchangeToken(customToken: String, idpConfigId: String, useStaging: Bool, completion: @escaping (FirebaseToken?, Error?) -> Void)
: Method to exchange the token, taking a completion handler.Auth.exchangeToken(customToken: String, idpConfigId: String, useStaging: Bool) async throws -> FirebaseToken
: Async/await version of the token exchange method.Details:
exchangeToken
methods use theExchangeTokenRequest
andExchangeTokenResponse
types to interact with the regionalizedidentityplatform.googleapis.com
backend.Auth
instance has been configured with aTenantConfig
(viaAuth.auth(app:tenantConfig:)
), aslocation
andtenantId
are necessary to construct the correct regional endpoint URL. An error is returned if these are not set.currentUser
on theAuth
instance. It purely exchanges a token.Introduces new public API surface to
FirebaseAuth
. This change depends on the previously introducedTenantConfig
,ExchangeTokenRequest
, andExchangeTokenResponse
.