-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adding Sample App Changes #15040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Sample App Changes #15040
Conversation
Using Gemini Code AssistThe 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
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 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. |
Generated by 🚫 Danger |
| private let kRegionalGCIPAPIHost = "identityplatform.googleapis.com" | ||
| private let kRegionalGCIPStagingAPIHost = "staging-identityplatform.sandbox.googleapis.com" |
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: Prefer the non-prefixed versions for constants. The k prefix is more common in ObjC
| 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 : |
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 is there global and prod-global?
| var app: FirebaseApp | ||
|
|
||
| // Initialise Auth with TenantConfig | ||
| let tenantConfig = Auth.TenantConfig(tenantId: "Foo-e2e-tenant-007", location: "global") |
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.
TenantConfig should be moved out of Auth namespace.
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.