Skip to content

Commit 72430e8

Browse files
authored
Merge branch 'main' into cheryllin/firestoreSwiftCpp
2 parents eb6620b + 075679d commit 72430e8

File tree

33 files changed

+303
-61
lines changed

33 files changed

+303
-61
lines changed

.github/workflows/prerelease.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
# Run every day at 9pm (PST) - cron uses UTC times
1010
- cron: '0 5 * * *'
1111

12+
env:
13+
FIREBASE_CI: true
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
1417
cancel-in-progress: true

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
# Run every day at 9pm (PST) - cron uses UTC times
1212
- cron: '0 5 * * *'
1313

14+
env:
15+
FIREBASE_CI: true
16+
1417
concurrency:
1518
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
1619
cancel-in-progress: true

FirebaseAuth/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 11.8.0
2+
- [added] Added `ActionCodeSettings.linkDomain` to customize the Firebase Hosting link domain
3+
that is used in out-of-band email action flows.
4+
- [deprecated] Deprecated `ActionCodeSettings.dynamicLinkDomain`.
5+
16
# 11.7.0
27
- [fixed] Fix Multi-factor session crash on second Firebase app. (#14238)
38
- [fixed] Updated most decoders to be consistent with Firebase 10's behavior

FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ import Foundation
4040
@objc open var androidInstallIfNotAvailable: Bool = false
4141

4242
/// The Firebase Dynamic Link domain used for out of band code flow.
43+
#if !FIREBASE_CI
44+
@available(
45+
*,
46+
deprecated,
47+
message: "Firebase Dynamic Links is deprecated. Migrate to use Firebase Hosting link and use `linkDomain` to set a custom domain instead."
48+
)
49+
#endif // !FIREBASE_CI
4350
@objc open var dynamicLinkDomain: String?
4451

52+
/// The out of band custom domain for handling code in app.
53+
@objc public var linkDomain: String?
54+
4555
/// Sets the iOS bundle ID.
4656
@objc override public init() {
4757
iOSBundleID = Bundle.main.bundleIdentifier

FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ final class AuthBackend: AuthBackendProtocol {
385385
.missingAppCredential(message: serverDetailErrorMessage)
386386
case "INVALID_CODE": return AuthErrorUtils
387387
.invalidVerificationCodeError(message: serverDetailErrorMessage)
388+
case "INVALID_HOSTING_LINK_DOMAIN": return AuthErrorUtils
389+
.invalidHostingLinkDomainError(message: serverDetailErrorMessage)
388390
case "INVALID_SESSION_INFO": return AuthErrorUtils
389391
.invalidVerificationIDError(message: serverDetailErrorMessage)
390392
case "SESSION_EXPIRED": return AuthErrorUtils

FirebaseAuth/Sources/Swift/Backend/RPC/GetOOBConfirmationCodeRequest.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ private let kCanHandleCodeInAppKey = "canHandleCodeInApp"
7878
/// The key for the "dynamic link domain" value in the request.
7979
private let kDynamicLinkDomainKey = "dynamicLinkDomain"
8080

81+
/// The key for the "link domain" value in the request.
82+
private let kLinkDomainKey = "linkDomain"
83+
8184
/// The value for the "PASSWORD_RESET" request type.
8285
private let kPasswordResetRequestTypeValue = "PASSWORD_RESET"
8386

@@ -140,6 +143,9 @@ class GetOOBConfirmationCodeRequest: IdentityToolkitRequest, AuthRPCRequest {
140143
/// The Firebase Dynamic Link domain used for out of band code flow.
141144
private let dynamicLinkDomain: String?
142145

146+
/// The Firebase Hosting domain used for out of band code flow.
147+
private(set) var linkDomain: String?
148+
143149
/// Response to the captcha.
144150
var captchaResponse: String?
145151

@@ -172,6 +178,7 @@ class GetOOBConfirmationCodeRequest: IdentityToolkitRequest, AuthRPCRequest {
172178
androidInstallApp = actionCodeSettings?.androidInstallIfNotAvailable ?? false
173179
handleCodeInApp = actionCodeSettings?.handleCodeInApp ?? false
174180
dynamicLinkDomain = actionCodeSettings?.dynamicLinkDomain
181+
linkDomain = actionCodeSettings?.linkDomain
175182

176183
super.init(
177184
endpoint: kGetOobConfirmationCodeEndpoint,
@@ -274,6 +281,9 @@ class GetOOBConfirmationCodeRequest: IdentityToolkitRequest, AuthRPCRequest {
274281
if let dynamicLinkDomain {
275282
body[kDynamicLinkDomainKey] = dynamicLinkDomain
276283
}
284+
if let linkDomain {
285+
body[kLinkDomainKey] = linkDomain
286+
}
277287
if let captchaResponse {
278288
body[kCaptchaResponseKey] = captchaResponse
279289
}

FirebaseAuth/Sources/Swift/Utilities/AuthErrorUtils.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ class AuthErrorUtils {
370370
error(code: .invalidDynamicLinkDomain, message: message)
371371
}
372372

373+
static func invalidHostingLinkDomainError(message: String?) -> Error {
374+
error(code: .invalidHostingLinkDomain, message: message)
375+
}
376+
373377
static func missingOrInvalidNonceError(message: String?) -> Error {
374378
error(code: .missingOrInvalidNonce, message: message)
375379
}

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/SampleSwift/AuthenticationExample/Models/AuthMenu.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum AuthMenu: String {
4343
case deleteApp
4444
case actionType
4545
case continueURL
46+
case linkDomain
4647
case requestVerifyEmail
4748
case requestPasswordReset
4849
case resetPassword
@@ -117,6 +118,8 @@ enum AuthMenu: String {
117118
return "Action Type"
118119
case .continueURL:
119120
return "Continue URL"
121+
case .linkDomain:
122+
return "Link Domain"
120123
case .requestVerifyEmail:
121124
return "Request Verify Email"
122125
case .requestPasswordReset:
@@ -197,6 +200,8 @@ enum AuthMenu: String {
197200
self = .actionType
198201
case "Continue URL":
199202
self = .continueURL
203+
case "Link Domain":
204+
self = .linkDomain
200205
case "Request Verify Email":
201206
self = .requestVerifyEmail
202207
case "Request Password Reset":
@@ -328,6 +333,7 @@ class AuthMenuData: DataSourceProvidable {
328333
let items: [Item] = [
329334
Item(title: AuthMenu.actionType.name, detailTitle: ActionCodeRequestType.inApp.name),
330335
Item(title: AuthMenu.continueURL.name, detailTitle: "--", isEditable: true),
336+
Item(title: AuthMenu.linkDomain.name, detailTitle: "--", isEditable: true),
331337
Item(title: AuthMenu.requestVerifyEmail.name),
332338
Item(title: AuthMenu.requestPasswordReset.name),
333339
Item(title: AuthMenu.resetPassword.name),

FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AccountLinkingViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ class AccountLinkingViewController: UIViewController, DataSourceProviderDelegate
354354
/// Similar to in `PasswordlessViewController`, enter the authorized domain.
355355
/// Please refer to this Quickstart's README for more information.
356356
private let authorizedDomain: String = "ENTER AUTHORIZED DOMAIN"
357+
358+
/// This is the replacement for customized dynamic link domain.
359+
private let customDomain: String = "ENTER AUTHORIZED HOSTING DOMAIN"
357360
/// Maintain a reference to the email entered for linking user to Passwordless.
358361
private var email: String?
359362

@@ -380,6 +383,7 @@ class AccountLinkingViewController: UIViewController, DataSourceProviderDelegate
380383
// The sign-in operation must be completed in the app.
381384
actionCodeSettings.handleCodeInApp = true
382385
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
386+
actionCodeSettings.linkDomain = customDomain
383387

384388
AppManager.shared.auth()
385389
.sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings) { error in

0 commit comments

Comments
 (0)