Skip to content

Conversation

@srushtisv
Copy link
Contributor

This PR updates the FirebaseAuth test app AuthenticationExample to include a new menu item for testing the "Exchange Token" feature, which is part of the Bring Your Own CIAM (BYO-CIAM) support for Regionalized GCIP.

Changes:

AuthMenu.swift: Added a new case .exchangeToken and a corresponding section exchangeTokenSection.
AuthViewController.swift:
Added handling for the .exchangeToken case in didSelectRowAt.
Implemented the callExchangeToken() function, which prompts the user for an "OIDC Token" and "IDP Config ID" using showTextInputPrompt.
Calls the auth().exchangeToken() async method with the provided inputs and useStaging: true.
Displays success or error messages using showAlert.
AppManager.swift: Modified the auth() method to return an Auth instance configured with a default TenantConfig("tenantId", "prod-global"). This is necessary for the exchangeToken calls to target a regionalized endpoint.
To provide a way to manually test and demonstrate the new Auth.exchangeToken() SDK methods within the sample application AuthenticationExample environment.

Testing:

Manual testing steps:

Run the Sample AuthenticationExample app.
Navigate to the "Exchange Token [Regionalized]" section.
Tap "Exchange Token".
Enter a test OIDC token and IDP Configuration ID when prompted.
Observe the alert indicating success or failure. Check console logs for details.
Also, corrects accessToken in ExchangeTokenResponse.

@gemini-code-assist
Copy link
Contributor

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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

@srushtisv srushtisv self-assigned this Jun 24, 2025
@google-oss-bot
Copy link

1 Warning
⚠️ Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by 🚫 Danger

@srushtisv srushtisv marked this pull request as ready for review June 24, 2025 23:10
@srushtisv srushtisv requested review from ncooke3 and pashanka June 24, 2025 23:21
Comment on lines +17 to +18
private let kRegionalGCIPAPIHost = "identityplatform.googleapis.com"
private let kRegionalGCIPStagingAPIHost = "staging-identityplatform.sandbox.googleapis.com"
Copy link
Member

Choose a reason for hiding this comment

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

nit: Prefer the non-prefixed versions for constants. The k prefix is more common in ObjC

Suggested change
private let kRegionalGCIPAPIHost = "identityplatform.googleapis.com"
private let kRegionalGCIPStagingAPIHost = "staging-identityplatform.sandbox.googleapis.com"
private let regionalGCIPAPIHost = "identityplatform.googleapis.com"
private let regionalGCIPStagingAPIHost = "staging-identityplatform.sandbox.googleapis.com"

components.queryItems = [URLQueryItem(name: "key", value: config.apiKey)]
guard let url = components.url else {
let baseHost = useStaging ? kRegionalGCIPStagingAPIHost : kRegionalGCIPAPIHost
let host = (location == "prod-global" || location == "global") ? baseHost :
Copy link
Member

Choose a reason for hiding this comment

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

Why is there global and prod-global?

var app: FirebaseApp

// Initialise Auth with TenantConfig
let tenantConfig = Auth.TenantConfig(tenantId: "Foo-e2e-tenant-007", location: "global")
Copy link
Member

Choose a reason for hiding this comment

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

TenantConfig should be moved out of Auth namespace.

@srushtisv srushtisv merged commit 7d2339b into exchange-token-tests Jun 26, 2025
53 checks passed
@srushtisv srushtisv deleted the sample-app-byociam branch June 26, 2025 10:09
@firebase firebase locked and limited conversation to collaborators Jul 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants