Skip to content

Commit 4ce3a4d

Browse files
committed
removing emulator endpoint
1 parent b0ca282 commit 4ce3a4d

File tree

3 files changed

+13
-47
lines changed

3 files changed

+13
-47
lines changed

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@ public struct FirebaseToken: Sendable {
209209
return auth
210210
}
211211

212-
// public static func auth(app: FirebaseApp, tenantConfig: nil) -> Auth {
213-
// let auth = auth(app: app)
214-
// return auth
215-
// }
216-
217212
/// Synchronously gets the cached current user, or null if there is none.
218213
@objc public var currentUser: User? {
219214
kAuthGlobalWorkQueue.sync {

FirebaseAuth/Sources/Swift/Backend/IdentityToolkitRequest.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,16 @@ class IdentityToolkitRequest {
8484
!location.isEmpty,
8585
!tenant.isEmpty {
8686
let projectID = _requestConfiguration.auth?.app?.options.projectID
87-
// Choose emulator, staging, or prod host
88-
if let emulatorHostAndPort = emulatorHostAndPort {
89-
apiProtocol = kHttpProtocol
90-
apiHostAndPathPrefix = "\(emulatorHostAndPort)/\(kRegionalGCIPAPIHost)"
91-
} else if useStaging {
87+
if useStaging {
9288
apiProtocol = kHttpsProtocol
9389
apiHostAndPathPrefix = kRegionalGCIPStagingAPIHost
9490
} else {
9591
apiProtocol = kHttpsProtocol
9692
apiHostAndPathPrefix = kRegionalGCIPAPIHost
9793
}
9894
urlString =
99-
"\(apiProtocol)//\(apiHostAndPathPrefix)/v2/projects/\(projectID ?? "projectID")"
100-
+ "/locations/\(location)/tenants/\(tenant)/idpConfigs/\(endpoint)?key=\(apiKey)"
95+
"\(apiProtocol)//\(apiHostAndPathPrefix)/v2alpha/projects/\(projectID ?? "projectID")"
96+
+ "/locations/\(location)/tenants/\(tenant)/idpConfigs:\(endpoint)?key=\(apiKey)"
10197
}
10298
// legacy gcip existing logic
10399
else if useIdentityPlatform {

FirebaseAuth/Tests/Unit/IdentityToolkitRequestTests.swift

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ class IdentityToolkitRequestTests: XCTestCase {
157157
auth: auth, tenantConfig: tenantConfig)
158158
let request = IdentityToolkitRequest(endpoint: kEndpoint,
159159
requestConfiguration: requestConfiguration)
160-
let expectedURL = "https://identityplatform.googleapis.com/v2/projects/\(kProjectID)" +
161-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
160+
let expectedURL = "https://identityplatform.googleapis.com/v2alpha/projects/\(kProjectID)" +
161+
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs:\(kEndpoint)?key=\(kAPIKey)"
162162
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
163163
}
164164

@@ -182,33 +182,8 @@ class IdentityToolkitRequestTests: XCTestCase {
182182
requestConfiguration: requestConfiguration,
183183
useStaging: true)
184184
let expectedURL =
185-
"https://staging-identityplatform.sandbox.googleapis.com/v2/projects/\(kProjectID)" +
186-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
187-
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
188-
}
189-
190-
/** @fn testInitWithRGCIPIUseEmulatorExpectedRequestURL
191-
@brief Tests the @c requestURL method for R-GCIP with location, tenant ID, and emulator.
192-
*/
193-
func testInitWithRGCIPIUseEmulatorExpectedRequestURL() {
194-
let options = FirebaseOptions(googleAppID: "0:0000000000000:ios:0000000000000000",
195-
gcmSenderID: "00000000000000000-00000000000-000000000")
196-
options.apiKey = kAPIKey
197-
options.projectID = kProjectID
198-
let app = FirebaseApp(instanceWithName: "rGCIPAppEmulator", options: options)
199-
// Force initialize Auth for the app to set the weak reference in AuthRequestConfiguration
200-
let auth = Auth(app: app)
201-
auth.tenantID = kTenantID
202-
203-
let tenantConfig = TenantConfig(tenantId: kTenantID, location: kLocation)
204-
let requestConfiguration = AuthRequestConfiguration(apiKey: kAPIKey, appID: "appID",
205-
auth: auth, tenantConfig: tenantConfig)
206-
requestConfiguration.emulatorHostAndPort = kEmulatorHostAndPort
207-
let request = IdentityToolkitRequest(endpoint: kEndpoint,
208-
requestConfiguration: requestConfiguration)
209-
let expectedURL =
210-
"http://\(kEmulatorHostAndPort)/identityplatform.googleapis.com/v2/projects/\(kProjectID)" +
211-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
185+
"https://staging-identityplatform.sandbox.googleapis.com/v2alpha/projects/\(kProjectID)" +
186+
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs:\(kEndpoint)?key=\(kAPIKey)"
212187
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
213188
}
214189

@@ -232,8 +207,8 @@ class IdentityToolkitRequestTests: XCTestCase {
232207
let request = IdentityToolkitRequest(endpoint: kEndpoint,
233208
requestConfiguration: requestConfiguration)
234209
// The expected URL should use "projectID" as a placeholder
235-
let expectedURL = "https://identityplatform.googleapis.com/v2/projects/projectID" +
236-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
210+
let expectedURL = "https://identityplatform.googleapis.com/v2alpha/projects/projectID" +
211+
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs:\(kEndpoint)?key=\(kAPIKey)"
237212
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
238213
}
239214

@@ -359,8 +334,8 @@ class IdentityToolkitRequestTests: XCTestCase {
359334
requestConfiguration: requestConfiguration,
360335
useIdentityPlatform: true) // useIdentityPlatform is true
361336

362-
let expectedURL = "https://identityplatform.googleapis.com/v2/projects/\(kProjectID)" +
363-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
337+
let expectedURL = "https://identityplatform.googleapis.com/v2alpha/projects/\(kProjectID)" +
338+
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs:\(kEndpoint)?key=\(kAPIKey)"
364339
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
365340
}
366341

@@ -384,8 +359,8 @@ class IdentityToolkitRequestTests: XCTestCase {
384359
let request = IdentityToolkitRequest(endpoint: kEndpoint,
385360
requestConfiguration: requestConfiguration)
386361

387-
let expectedURL = "https://identityplatform.googleapis.com/v2/projects/\(kProjectID)" +
388-
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs/\(kEndpoint)?key=\(kAPIKey)"
362+
let expectedURL = "https://identityplatform.googleapis.com/v2alpha/projects/\(kProjectID)" +
363+
"/locations/\(kLocation)/tenants/\(kTenantID)/idpConfigs:\(kEndpoint)?key=\(kAPIKey)"
389364
XCTAssertEqual(expectedURL, request.requestURL().absoluteString)
390365
}
391366

0 commit comments

Comments
 (0)