Skip to content

Commit 9d88e3a

Browse files
Add ActionCodeSettings.linkDomain and deprecate ActionCodeSettings.dynamicLinkDomain (#8738)
* Add linkDomain field to ActionCodeSettings (#8428) * Add linkDomain field to ActionCodeSettings * Update API reports * Update error message for ERROR_INVALID_HOSTING_LINK_DOMAIN to include that default hosting domains cannot be used. * Use constants for test values --------- Co-authored-by: NhienLam <[email protected]> * FDL Deprecation & Hosting link Integration Test (#8603) * Implement Integration test for passwordless email sign-in via firebase-hosting links. * Add license to new test file created' did not match any files * Remove unwanted _ * Add support for setting custom hosting link domain in test app (#8614) * Add afterEach method and apply formatting to the hosting links integration test (#8615) * Mark ActionCodeSettings.dynamicLinkDomain as deprecated * Add changeset * Update API reports * Address review comments * Fix changeset * Update refdocs and address review comments * Update deprecated comment * Add FDL deprecation FAQ link * Fix linkDomain link in refdocs --------- Co-authored-by: NhienLam <[email protected]> Co-authored-by: mansisampat <[email protected]>
1 parent 2f92a74 commit 9d88e3a

File tree

18 files changed

+232
-37
lines changed

18 files changed

+232
-37
lines changed

.changeset/polite-lies-vanish.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'firebase': minor
3+
'@firebase/auth-types': minor
4+
'@firebase/auth': minor
5+
---
6+
7+
Added `ActionCodeSettings.linkDomain` to customize the Firebase Hosting link domain that is used in mobile out-of-band email action flows. Also, deprecated `ActionCodeSettings.dynamicLinkDomain`.

common/api-review/auth.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ export interface ActionCodeSettings {
4040
minimumVersion?: string;
4141
packageName: string;
4242
};
43+
// @deprecated
4344
dynamicLinkDomain?: string;
4445
handleCodeInApp?: boolean;
4546
iOS?: {
4647
bundleId: string;
4748
};
49+
linkDomain?: string;
4850
url: string;
4951
}
5052

@@ -236,6 +238,7 @@ export const AuthErrorCodes: {
236238
readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
237239
readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
238240
readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
241+
readonly INVALID_HOSTING_LINK_DOMAIN: "auth/invalid-hosting-link-domain";
239242
};
240243

241244
// @public

docs-devsite/auth.actioncodesettings.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ export interface ActionCodeSettings
2626
| [dynamicLinkDomain](./auth.actioncodesettings.md#actioncodesettingsdynamiclinkdomain) | string | When multiple custom dynamic link domains are defined for a project, specify which one to use when the link is to be opened via a specified mobile app (for example, <code>example.page.link</code>). |
2727
| [handleCodeInApp](./auth.actioncodesettings.md#actioncodesettingshandlecodeinapp) | boolean | When set to true, the action code link will be be sent as a Universal Link or Android App Link and will be opened by the app if installed. |
2828
| [iOS](./auth.actioncodesettings.md#actioncodesettingsios) | { bundleId: string; } | Sets the iOS bundle ID. |
29+
| [linkDomain](./auth.actioncodesettings.md#actioncodesettingslinkdomain) | string | The optional custom Firebase Hosting domain to use when the link is to be opened via a specified mobile app. The domain must be configured in Firebase Hosting and owned by the project. This cannot be a default Hosting domain (<code>web.app</code> or <code>firebaseapp.com</code>). |
2930
| [url](./auth.actioncodesettings.md#actioncodesettingsurl) | string | Sets the link continue/state URL. |
3031

3132
## ActionCodeSettings.android
3233

3334
Sets the Android package name.
3435

35-
This will try to open the link in an android app if it is installed. If `installApp` is passed, it specifies whether to install the Android app if the device supports it and the app is not already installed. If this field is provided without a `packageName`<!-- -->, an error is thrown explaining that the `packageName` must be provided in conjunction with this field. If `minimumVersion` is specified, and an older version of the app is installed, the user is taken to the Play Store to upgrade the app.
36+
This will try to open the link in an Android app if it is installed.
3637

3738
<b>Signature:</b>
3839

@@ -46,6 +47,11 @@ android?: {
4647

4748
## ActionCodeSettings.dynamicLinkDomain
4849

50+
> Warning: This API is now obsolete.
51+
>
52+
> Firebase Dynamic Links is deprecated and will be shut down as early as August 2025. Instead, use [ActionCodeSettings.linkDomain](./auth.actioncodesettings.md#actioncodesettingslinkdomain) to set a custom domain for mobile links. Learn more in the [Dynamic Links deprecation FAQ](https://firebase.google.com/support/dynamic-links-faq)<!-- -->.
53+
>
54+
4955
When multiple custom dynamic link domains are defined for a project, specify which one to use when the link is to be opened via a specified mobile app (for example, `example.page.link`<!-- -->).
5056

5157
<b>Signature:</b>
@@ -72,8 +78,6 @@ Sets the iOS bundle ID.
7278

7379
This will try to open the link in an iOS app if it is installed.
7480

75-
App installation is not supported for iOS.
76-
7781
<b>Signature:</b>
7882

7983
```typescript
@@ -82,11 +86,21 @@ iOS?: {
8286
};
8387
```
8488

89+
## ActionCodeSettings.linkDomain
90+
91+
The optional custom Firebase Hosting domain to use when the link is to be opened via a specified mobile app. The domain must be configured in Firebase Hosting and owned by the project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`<!-- -->).
92+
93+
<b>Signature:</b>
94+
95+
```typescript
96+
linkDomain?: string;
97+
```
98+
8599
## ActionCodeSettings.url
86100

87101
Sets the link continue/state URL.
88102

89-
This has different meanings in different contexts: - When the link is handled in the web action widgets, this is the deep link in the `continueUrl` query parameter. - When the link is handled in the app directly, this is the `continueUrl` query parameter in the deep link of the Dynamic Link.
103+
This has different meanings in different contexts: - When the link is handled in the web action widgets, this is the deep link in the `continueUrl` query parameter. - When the link is handled in the app directly, this is the `continueUrl` query parameter in the deep link of the Dynamic Link or Hosting link.
90104

91105
<b>Signature:</b>
92106

docs-devsite/auth.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,7 @@ AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
19561956
readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
19571957
readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
19581958
readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
1959+
readonly INVALID_HOSTING_LINK_DOMAIN: "auth/invalid-hosting-link-domain";
19591960
}
19601961
```
19611962

packages/auth-types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export type ActionCodeSettings = {
130130
iOS?: { bundleId: string };
131131
url: string;
132132
dynamicLinkDomain?: string;
133+
linkDomain?: string;
133134
};
134135

135136
export type AdditionalUserInfo = {

packages/auth/demo/public/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,11 @@
823823
<input type="text" class="form-control" id="ibi" placeholder="iOS Bundle ID"/>
824824
</div>
825825
</form>
826+
<div class="group">Mobile link</div>
827+
<div class="form-group">
828+
<input type="text" class="form-control" id="hostingLinkDomain"
829+
placeholder="Custom Hosting Link Domain"/>
830+
</div>
826831
<form class="form form-bordered no-submit">
827832
<div class="btn-group radio-block" id="handle-in-app-selection"
828833
data-toggle="buttons">

packages/auth/demo/src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ import {
4949
signInWithCredential,
5050
signInWithCustomToken,
5151
signInWithEmailAndPassword,
52+
signInWithEmailLink,
5253
TotpMultiFactorGenerator,
53-
TotpSecret,
5454
unlink,
5555
updateEmail,
5656
updatePassword,
@@ -995,6 +995,7 @@ function getActionCodeSettings() {
995995
const installApp = $('input[name=install-app]:checked').val() === 'Yes';
996996
const handleCodeInApp =
997997
$('input[name=handle-in-app]:checked').val() === 'Yes';
998+
const hostingLinkDomain = $('#hostingLinkDomain').val();
998999
if (url || apn || ibi) {
9991000
actionCodeSettings['url'] = url;
10001001
if (apn) {
@@ -1010,6 +1011,9 @@ function getActionCodeSettings() {
10101011
};
10111012
}
10121013
actionCodeSettings['handleCodeInApp'] = handleCodeInApp;
1014+
if (hostingLinkDomain) {
1015+
actionCodeSettings['linkDomain'] = hostingLinkDomain;
1016+
}
10131017
}
10141018
return actionCodeSettings;
10151019
}
@@ -1020,6 +1024,7 @@ function onActionCodeSettingsReset() {
10201024
$('#apn').val('');
10211025
$('#amv').val('');
10221026
$('#ibi').val('');
1027+
$('#hostingLinkDomain').val('');
10231028
}
10241029

10251030
/**

packages/auth/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ function getTestFiles(argv) {
4141
return [
4242
'test/integration/flows/totp.test.ts',
4343
'test/integration/flows/password_policy.test.ts',
44-
'test/integration/flows/recaptcha_enterprise.test.ts'
44+
'test/integration/flows/recaptcha_enterprise.test.ts',
45+
'test/integration/flows/hosting_link.test.ts'
4546
];
4647
}
4748
return argv.local

packages/auth/src/api/authentication/email_and_password.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export interface GetOobCodeRequest {
7070
dynamicLinkDomain?: string;
7171
tenantId?: string;
7272
targetProjectid?: string;
73+
linkDomain?: string;
7374
}
7475

7576
export interface VerifyEmailRequest extends GetOobCodeRequest {

packages/auth/src/api/errors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export const enum ServerError {
100100
MISSING_RECAPTCHA_VERSION = 'MISSING_RECAPTCHA_VERSION',
101101
INVALID_RECAPTCHA_VERSION = 'INVALID_RECAPTCHA_VERSION',
102102
INVALID_REQ_TYPE = 'INVALID_REQ_TYPE',
103-
PASSWORD_DOES_NOT_MEET_REQUIREMENTS = 'PASSWORD_DOES_NOT_MEET_REQUIREMENTS'
103+
PASSWORD_DOES_NOT_MEET_REQUIREMENTS = 'PASSWORD_DOES_NOT_MEET_REQUIREMENTS',
104+
INVALID_HOSTING_LINK_DOMAIN = 'INVALID_HOSTING_LINK_DOMAIN'
104105
}
105106

106107
/**

0 commit comments

Comments
 (0)