-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adding Sample App Changes #14985
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: exchange-token-tests
Are you sure you want to change the base?
Adding Sample App Changes #14985
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Generated by 🚫 Danger |
@@ -1,4 +1,4 @@ | |||
// Copyright 2025 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Nick, Just a typo on my part — fixed it.
// 1. Prompt for the custom OIDC token and await user input. | ||
guard let idToken = await showTextInputPrompt(with: "Enter OIDC Token:") else { | ||
print("Token exchange cancelled: OIDC Token was not provided.") | ||
// Present an alert on the main thread to indicate cancellation. | ||
DispatchQueue.main.async { | ||
let alert = UIAlertController(title: "Cancelled", | ||
message: "An OIDC Token is required to proceed.", | ||
preferredStyle: .alert) | ||
alert.addAction(UIAlertAction(title: "OK", style: .default)) | ||
self.present(alert, animated: true) | ||
} | ||
return | ||
} | ||
|
||
// 2. Prompt for the IDP Config ID and await user input. | ||
guard let idpConfigId = await showTextInputPrompt(with: "Enter IDP Config ID:") else { | ||
print("Token exchange cancelled: IDP Config ID was not provided.") | ||
// Present an alert on the main thread to indicate cancellation. | ||
DispatchQueue.main.async { | ||
let alert = UIAlertController(title: "Cancelled", | ||
message: "An IDP Config ID is required to proceed.", | ||
preferredStyle: .alert) | ||
alert.addAction(UIAlertAction(title: "OK", style: .default)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Shouldn't the order of this prompt be the other way, get the idpConfigId first and then it's corresponding token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes Pavan, this would be more intuitive. I’ll reorder the prompt.
Description
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 sectionexchangeTokenSection
.AuthViewController.swift
:.exchangeToken
case indidSelectRowAt
.callExchangeToken()
function, which prompts the user for an "OIDC Token" and "IDP Config ID" usingshowTextInputPrompt
.auth().exchangeToken()
async method with the provided inputs anduseStaging: true
.showAlert
.AppManager.swift
: Modified theauth()
method to return anAuth
instance configured with a defaultTenantConfig("tenantId", "prod-global")
. This is necessary for theexchangeToken
calls to target a regionalized endpoint.To provide a way to manually test and demonstrate the new
Auth.exchangeToken()
SDK methods within the sample applicationAuthenticationExample
environment.Testing:
Manual testing steps:
Also, corrects accessToken in ExchangeTokenResponse.