Skip to content

Commit 97d9e60

Browse files
adding invalid-hosting-link-domain error code and API tests (#13506)
1 parent f7c6f90 commit 97d9e60

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation
485485
.missingAppCredential(message: serverDetailErrorMessage)
486486
case "INVALID_CODE": return AuthErrorUtils
487487
.invalidVerificationCodeError(message: serverDetailErrorMessage)
488+
case "INVALID_HOSTING_LINK_DOMAIN": return AuthErrorUtils
489+
.invalidHostingLinkDomainError(message: serverDetailErrorMessage)
488490
case "INVALID_SESSION_INFO": return AuthErrorUtils
489491
.invalidVerificationIDError(message: serverDetailErrorMessage)
490492
case "SESSION_EXPIRED": return AuthErrorUtils

FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ class AuthErrorUtils: NSObject {
366366
error(code: .invalidDynamicLinkDomain, message: message)
367367
}
368368

369+
static func invalidHostingLinkDomainError(message: String?) -> Error {
370+
error(code: .invalidHostingLinkDomain, message: message)
371+
}
372+
369373
static func missingOrInvalidNonceError(message: String?) -> Error {
370374
error(code: .missingOrInvalidNonce, message: message)
371375
}

FirebaseAuth/Sources/Swift/Utilities/AuthErrors.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ import Foundation
258258
/// unauthorized for the current project.
259259
case invalidDynamicLinkDomain = 17074
260260

261+
/// Indicates that the provided Firebase Hosting Link domain is not owned by the current project.
262+
case invalidHostingLinkDomain = 17214
263+
261264
/// Indicates that the credential is rejected because it's malformed or mismatching.
262265
case rejectedCredential = 17075
263266

@@ -468,6 +471,8 @@ import Foundation
468471
return kErrorInvalidProviderID
469472
case .invalidDynamicLinkDomain:
470473
return kErrorInvalidDynamicLinkDomain
474+
case .invalidHostingLinkDomain:
475+
return kErrorInvalidHostingLinkDomain
471476
case .webInternalError:
472477
return kErrorWebInternalError
473478
case .webSignInUserInteractionFailure:
@@ -661,6 +666,8 @@ import Foundation
661666
return "ERROR_INVALID_PROVIDER_ID"
662667
case .invalidDynamicLinkDomain:
663668
return "ERROR_INVALID_DYNAMIC_LINK_DOMAIN"
669+
case .invalidHostingLinkDomain:
670+
return "ERROR_INVALID_HOSTING_LINK_DOMAIN"
664671
case .webInternalError:
665672
return "ERROR_WEB_INTERNAL_ERROR"
666673
case .webSignInUserInteractionFailure:
@@ -905,6 +912,9 @@ private let kErrorInvalidProviderID =
905912
private let kErrorInvalidDynamicLinkDomain =
906913
"The Firebase Dynamic Link domain used is either not configured or is unauthorized for the current project."
907914

915+
private let kErrorInvalidHostingLinkDomain =
916+
"The provided hosting link domain is not configured in Firebase Hosting or is not owned by the current project."
917+
908918
private let kErrorInternalError =
909919
"An internal error has occurred, print and inspect the error details for more information."
910920

FirebaseAuth/Tests/Unit/ObjCAPITests.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ - (void)FIRActionCodeSettings_h {
6565
s = [codeSettings androidPackageName];
6666
s = [codeSettings androidMinimumVersion];
6767
s = [codeSettings dynamicLinkDomain];
68+
s = [codeSettings linkDomain];
6869
}
6970

7071
- (void)FIRAuthAdditionalUserInfo_h:(FIRAdditionalUserInfo *)additionalUserInfo {
@@ -280,6 +281,7 @@ - (void)FIRAuthErrors_h {
280281
c = FIRAuthErrorCodeTenantIDMismatch;
281282
c = FIRAuthErrorCodeUnsupportedTenantOperation;
282283
c = FIRAuthErrorCodeInvalidDynamicLinkDomain;
284+
c = FIRAuthErrorCodeInvalidHostingLinkDomain;
283285
c = FIRAuthErrorCodeRejectedCredential;
284286
c = FIRAuthErrorCodeGameKitNotLinked;
285287
c = FIRAuthErrorCodeSecondFactorRequired;

FirebaseAuth/Tests/Unit/SwiftAPI.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
4141
let _: String = codeSettings.iOSBundleID,
4242
let _: String = codeSettings.androidPackageName,
4343
let _: String = codeSettings.androidMinimumVersion,
44-
let _: String = codeSettings.dynamicLinkDomain {}
44+
let _: String = codeSettings.dynamicLinkDomain,
45+
let _: String = codeSettings.linkDomain {}
4546
}
4647

4748
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
@@ -276,6 +277,7 @@ class AuthAPI_hOnlyTests: XCTestCase {
276277
_ = AuthErrorCode.tenantIDMismatch
277278
_ = AuthErrorCode.unsupportedTenantOperation
278279
_ = AuthErrorCode.invalidDynamicLinkDomain
280+
_ = AuthErrorCode.invalidHostingLinkDomain
279281
_ = AuthErrorCode.rejectedCredential
280282
_ = AuthErrorCode.gameKitNotLinked
281283
_ = AuthErrorCode.secondFactorRequired

0 commit comments

Comments
 (0)