Skip to content

Commit 7df3588

Browse files
authored
Merge branch 'master' into je-impersonation
2 parents e9f6d40 + b26d13a commit 7df3588

17 files changed

+561
-25
lines changed

.github/actions/send-email/package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

etc/firebase-admin.auth.api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ export interface ActionCodeSettings {
1313
installApp?: boolean;
1414
minimumVersion?: string;
1515
};
16+
// @deprecated
1617
dynamicLinkDomain?: string;
1718
handleCodeInApp?: boolean;
1819
iOS?: {
1920
bundleId: string;
2021
};
22+
linkDomain?: string;
2123
url: string;
2224
}
2325

@@ -221,6 +223,11 @@ export class AuthClientErrorCode {
221223
message: string;
222224
};
223225
// (undocumented)
226+
static INVALID_HOSTING_LINK_DOMAIN: {
227+
code: string;
228+
message: string;
229+
};
230+
// (undocumented)
224231
static INVALID_ID_TOKEN: {
225232
code: string;
226233
message: string;
@@ -757,6 +764,14 @@ export interface ListUsersResult {
757764
users: UserRecord[];
758765
}
759766

767+
// @public
768+
export interface MobileLinksConfig {
769+
domain?: MobileLinksDomain;
770+
}
771+
772+
// @public
773+
export type MobileLinksDomain = 'HOSTING_DOMAIN' | 'FIREBASE_DYNAMIC_LINK_DOMAIN';
774+
760775
// @public
761776
export interface MultiFactorConfig {
762777
factorIds?: AuthFactorType[];
@@ -847,6 +862,7 @@ export class PhoneMultiFactorInfo extends MultiFactorInfo {
847862
// @public
848863
export class ProjectConfig {
849864
readonly emailPrivacyConfig?: EmailPrivacyConfig;
865+
readonly mobileLinksConfig?: MobileLinksConfig;
850866
get multiFactorConfig(): MultiFactorConfig | undefined;
851867
readonly passwordPolicyConfig?: PasswordPolicyConfig;
852868
get recaptchaConfig(): RecaptchaConfig | undefined;
@@ -996,6 +1012,7 @@ export interface UpdatePhoneMultiFactorInfoRequest extends BaseUpdateMultiFactor
9961012
// @public
9971013
export interface UpdateProjectConfigRequest {
9981014
emailPrivacyConfig?: EmailPrivacyConfig;
1015+
mobileLinksConfig?: MobileLinksConfig;
9991016
multiFactorConfig?: MultiFactorConfig;
10001017
passwordPolicyConfig?: PasswordPolicyConfig;
10011018
recaptchaConfig?: RecaptchaConfig;

package-lock.json

Lines changed: 71 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-admin",
3-
"version": "13.0.2",
3+
"version": "13.1.0",
44
"description": "Firebase admin SDK for Node.js",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",

src/auth/action-code-settings-builder.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,27 @@ export interface ActionCodeSettings {
9494
* configured per project. This field provides the ability to explicitly choose
9595
* configured per project. This fields provides the ability explicitly choose
9696
* one. If none is provided, the oldest domain is used by default.
97+
* @deprecated use `linkDomain` instead
9798
*/
9899
dynamicLinkDomain?: string;
100+
101+
/**
102+
* Defines the custom Firebase Hosting domain to use when the link is to be opened
103+
* via a specified mobile app,
104+
* This is a replacement of Firebase Dynamic Link.
105+
* If none is provided,
106+
* a default hosting domain will be used (for example, `example.firebaseapp.com`)
107+
*/
108+
109+
linkDomain?: string;
99110
}
100111

101112
/** Defines the email action code server request. */
102113
interface EmailActionCodeRequest {
103114
continueUrl?: string;
104115
canHandleCodeInApp?: boolean;
105116
dynamicLinkDomain?: string;
117+
linkDomain?: string;
106118
androidPackageName?: string;
107119
androidMinimumVersion: string;
108120
androidInstallApp?: boolean;
@@ -123,6 +135,7 @@ export class ActionCodeSettingsBuilder {
123135
private ibi?: string;
124136
private canHandleCodeInApp?: boolean;
125137
private dynamicLinkDomain?: string;
138+
private linkDomain?: string;
126139

127140
/**
128141
* ActionCodeSettingsBuilder constructor.
@@ -166,6 +179,14 @@ export class ActionCodeSettingsBuilder {
166179
}
167180
this.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
168181

182+
if (typeof actionCodeSettings.linkDomain !== 'undefined' &&
183+
!validator.isNonEmptyString(actionCodeSettings.linkDomain)) {
184+
throw new FirebaseAuthError(
185+
AuthClientErrorCode.INVALID_HOSTING_LINK_DOMAIN,
186+
);
187+
}
188+
this.linkDomain = actionCodeSettings.linkDomain;
189+
169190
if (typeof actionCodeSettings.iOS !== 'undefined') {
170191
if (!validator.isNonNullObject(actionCodeSettings.iOS)) {
171192
throw new FirebaseAuthError(
@@ -230,6 +251,7 @@ export class ActionCodeSettingsBuilder {
230251
continueUrl: this.continueUrl,
231252
canHandleCodeInApp: this.canHandleCodeInApp,
232253
dynamicLinkDomain: this.dynamicLinkDomain,
254+
linkDomain: this.linkDomain,
233255
androidPackageName: this.apn,
234256
androidMinimumVersion: this.amv,
235257
androidInstallApp: this.installApp,

src/auth/auth-config.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,60 @@ export interface PasswordPolicyConfig {
21372137
constraints?: CustomStrengthOptionsConfig;
21382138
}
21392139

2140+
/**
2141+
* Configuration for settings related to univeral links (iOS)
2142+
* and app links (Android).
2143+
*/
2144+
export interface MobileLinksConfig {
2145+
/**
2146+
* Use Firebase Hosting or dynamic link domain as the out-of-band code domain.
2147+
*/
2148+
domain?: MobileLinksDomain;
2149+
}
2150+
2151+
/**
2152+
* Open code in app domain to use for app links and universal links.
2153+
*/
2154+
export type MobileLinksDomain = 'HOSTING_DOMAIN' | 'FIREBASE_DYNAMIC_LINK_DOMAIN';
2155+
2156+
/**
2157+
* Defines the MobileLinksAuthConfig class used for validation.
2158+
*
2159+
* @internal
2160+
*/
2161+
export class MobileLinksAuthConfig {
2162+
public static validate(options: MobileLinksConfig): void {
2163+
if (!validator.isNonNullObject(options)) {
2164+
throw new FirebaseAuthError(
2165+
AuthClientErrorCode.INVALID_CONFIG,
2166+
'"MobileLinksConfig" must be a non-null object.',
2167+
);
2168+
}
2169+
2170+
const validKeys = {
2171+
domain: true,
2172+
};
2173+
2174+
for (const key in options) {
2175+
if (!(key in validKeys)) {
2176+
throw new FirebaseAuthError(
2177+
AuthClientErrorCode.INVALID_CONFIG,
2178+
`"${key}" is not a valid "MobileLinksConfig" parameter.`,
2179+
);
2180+
}
2181+
}
2182+
2183+
if (typeof options.domain !== 'undefined'
2184+
&& options.domain !== 'HOSTING_DOMAIN'
2185+
&& options.domain !== 'FIREBASE_DYNAMIC_LINK_DOMAIN') {
2186+
throw new FirebaseAuthError(
2187+
AuthClientErrorCode.INVALID_CONFIG,
2188+
'"MobileLinksConfig.domain" must be either "HOSTING_DOMAIN" or "FIREBASE_DYNAMIC_LINK_DOMAIN".',
2189+
);
2190+
}
2191+
}
2192+
}
2193+
21402194
/**
21412195
* A password policy's enforcement state.
21422196
*/

src/auth/base-auth.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ export abstract class BaseAuth {
749749
* minimumVersion: '12'
750750
* },
751751
* handleCodeInApp: true,
752-
* dynamicLinkDomain: 'custom.page.link'
752+
* linkDomain: 'project-id.firebaseapp.com'
753753
* };
754754
* admin.auth()
755755
* .generatePasswordResetLink('[email protected]', actionCodeSettings)
@@ -802,7 +802,7 @@ export abstract class BaseAuth {
802802
* minimumVersion: '12'
803803
* },
804804
* handleCodeInApp: true,
805-
* dynamicLinkDomain: 'custom.page.link'
805+
* linkDomain: 'project-id.firebaseapp.com'
806806
* };
807807
* admin.auth()
808808
* .generateEmailVerificationLink('[email protected]', actionCodeSettings)
@@ -883,7 +883,7 @@ export abstract class BaseAuth {
883883
* minimumVersion: '12'
884884
* },
885885
* handleCodeInApp: true,
886-
* dynamicLinkDomain: 'custom.page.link'
886+
* linkDomain: 'project-id.firebaseapp.com'
887887
* };
888888
* admin.auth()
889889
* .generateEmailVerificationLink('[email protected]', actionCodeSettings)

src/auth/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ export {
104104
PasswordPolicyEnforcementState,
105105
CustomStrengthOptionsConfig,
106106
EmailPrivacyConfig,
107+
MobileLinksConfig,
108+
MobileLinksDomain,
107109
} from './auth-config';
108110

109111
export {

0 commit comments

Comments
 (0)