@@ -215,9 +215,59 @@ firebase.User.prototype.reload = function() {};
215215 * The verification process is completed by calling
216216 * {@link firebase.auth.Auth#applyActionCode}
217217 *
218+ * <h4>Error Codes</h4>
219+ * <dl>
220+ * <dt>auth/missing-android-pkg-name</dt>
221+ * <dd>An Android package name must be provided if the Android app is required
222+ * to be installed.</dd>
223+ * <dt>auth/missing-continue-uri</dt>
224+ * <dd>A continue URL must be provided in the request.</dd>
225+ * <dt>auth/missing-ios-bundle-id</dt>
226+ * <dd>An iOS bundle ID must be provided if an App Store ID is provided.</dd>
227+ * <dt>auth/invalid-continue-uri</dt>
228+ * <dd>The continue URL provided in the request is invalid.</dd>
229+ * <dt>auth/unauthorized-continue-uri</dt>
230+ * <dd>The domain of the continue URL is not whitelisted. Whitelist
231+ * the domain in the Firebase console.</dd>
232+ * </dl>
233+ *
234+ * @example
235+ * var actionCodeSettings = {
236+ * url: 'https://www.example.com/cart?email=user@example .com&cartId=123',
237+ * iOS: {
238+ * bundleId: 'com.example.ios'
239+ * },
240+ * android: {
241+ * packageName: 'com.example.android',
242+ * installApp: true,
243+ * minimumVersion: '12'
244+ * },
245+ * handleCodeInApp: true
246+ * };
247+ * firebase.auth().currentUser.sendEmailVerification(actionCodeSettings)
248+ * .then(function() {
249+ * // Verification email sent.
250+ * })
251+ * .catch(function(error) {
252+ * // Error occurred. Inspect error.code.
253+ * });
254+ *
255+ * @param {?firebase.auth.ActionCodeSettings= } actionCodeSettings The action
256+ * code settings. If specified, the state/continue URL will be set as the
257+ * "continueUrl" parameter in the email verification link. The default email
258+ * verification landing page will use this to display a link to go back to
259+ * the app if it is installed.
260+ * If the actionCodeSettings is not specified, no URL is appended to the
261+ * action URL.
262+ * The state URL provided must belong to a domain that is whitelisted by the
263+ * developer in the console. Otherwise an error will be thrown.
264+ * Mobile app redirects will only be applicable if the developer configures
265+ * and accepts the Firebase Dynamic Links terms of condition.
266+ * The Android package name and iOS bundle ID will be respected only if they
267+ * are configured in the same Firebase Auth project used.
218268 * @return {!firebase.Promise<void> }
219269 */
220- firebase . User . prototype . sendEmailVerification = function ( ) { } ;
270+ firebase . User . prototype . sendEmailVerification = function ( actionCodeSettings ) { } ;
221271
222272
223273/**
@@ -709,6 +759,48 @@ firebase.auth.ActionCodeInfo = function() {};
709759firebase . auth . ActionCodeInfo . prototype . data ;
710760
711761
762+ /**
763+ * This is the interface that defines the required continue/state URL with
764+ * optional Android and iOS bundle identifiers.
765+ * The action code setting fields are:
766+ * <ul>
767+ * <li><p>url: Sets the link continue/state URL, which has different meanings
768+ * in different contexts:</p>
769+ * <ul>
770+ * <li>When the link is handled in the web action widgets, this is the deep
771+ * link in the continueUrl query parameter.</li>
772+ * <li>When the link is handled in the app directly, this is the continueUrl
773+ * query parameter in the deep link of the Dynamic Link.</li>
774+ * </ul>
775+ * </li>
776+ * <li>iOS: Sets the iOS bundle ID. This will try to open the link in an iOS app
777+ * if it is installed.</li>
778+ * <li>android: Sets the Android package name. This will try to open the link in
779+ * an android app if it is installed. If installApp is passed, it specifies
780+ * whether to install the Android app if the device supports it and the app
781+ * is not already installed. If this field is provided without a
782+ * packageName, an error is thrown explaining that the packageName must be
783+ * provided in conjunction with this field.
784+ * If minimumVersion is specified, and an older version of the app is
785+ * installed, the user is taken to the Play Store to upgrade the app.</li>
786+ * <li>handleCodeInApp: The default is false. When set to true, the action code
787+ * link will be be sent as a Universal Link or Android App Link and will be
788+ * opened by the app if installed. In the false case, the code will be sent
789+ * to the web widget first and then on continue will redirect to the app if
790+ * installed.</li>
791+ * </ul>
792+ *
793+ * @typedef {{
794+ * url: string,
795+ * iOS: ({bundleId: string}|undefined),
796+ * android: ({packageName: string, installApp: (boolean|undefined),
797+ * minimumVersion: (string|undefined)}|undefined),
798+ * handleCodeInApp: (boolean|undefined)
799+ * }}
800+ */
801+ firebase . auth . ActionCodeSettings ;
802+
803+
712804/**
713805 * Checks a verification code sent to the user by email or other out-of-band
714806 * mechanism.
@@ -857,6 +949,24 @@ firebase.auth.Auth.Persistence = {
857949 */
858950firebase . auth . Auth . prototype . setPersistence = function ( persistence ) { } ;
859951
952+ /**
953+ * The current Auth instance's language code. This is a readable/writable
954+ * property. When set to null, the default Firebase Console language setting
955+ * is applied. The language code will propagate to email action templates
956+ * (password reset, email verification and email change revocation), SMS
957+ * templates for phone authentication, reCAPTCHA verifier and OAuth
958+ * popup/redirect operations provided the specified providers support
959+ * localization with the language code specified.
960+ *
961+ * @type {string|null }
962+ */
963+ firebase . auth . Auth . prototype . languageCode ;
964+
965+ /**
966+ * Sets the current language to the default device/browser preference.
967+ */
968+ firebase . auth . Auth . prototype . useDeviceLanguage = function ( ) { } ;
969+
860970/**
861971 * Creates a new user account associated with the specified email address and
862972 * password.
@@ -987,14 +1097,62 @@ firebase.auth.Auth.prototype.onIdTokenChanged = function(
9871097 * <dl>
9881098 * <dt>auth/invalid-email</dt>
9891099 * <dd>Thrown if the email address is not valid.</dd>
1100+ * <dt>auth/missing-android-pkg-name</dt>
1101+ * <dd>An Android package name must be provided if the Android app is required
1102+ * to be installed.</dd>
1103+ * <dt>auth/missing-continue-uri</dt>
1104+ * <dd>A continue URL must be provided in the request.</dd>
1105+ * <dt>auth/missing-ios-bundle-id</dt>
1106+ * <dd>An iOS Bundle ID must be provided if an App Store ID is provided.</dd>
1107+ * <dt>auth/invalid-continue-uri</dt>
1108+ * <dd>The continue URL provided in the request is invalid.</dd>
1109+ * <dt>auth/unauthorized-continue-uri</dt>
1110+ * <dd>The domain of the continue URL is not whitelisted. Whitelist
1111+ * the domain in the Firebase console.</dd>
9901112 * <dt>auth/user-not-found</dt>
9911113 * <dd>Thrown if there is no user corresponding to the email address.</dd>
9921114 * </dl>
9931115 *
1116+ * @example
1117+ * var actionCodeSettings = {
1118+ * url: 'https://www.example.com/?email=user@example .com',
1119+ * iOS: {
1120+ * bundleId: 'com.example.ios'
1121+ * },
1122+ * android: {
1123+ * packageName: 'com.example.android',
1124+ * installApp: true,
1125+ * minimumVersion: '12'
1126+ * },
1127+ * handleCodeInApp: true
1128+ * };
1129+ * firebase.auth().sendPasswordResetEmail(
1130+ * 'user@example.com', actionCodeSettings)
1131+ * .then(function() {
1132+ * // Password reset email sent.
1133+ * })
1134+ * .catch(function(error) {
1135+ * // Error occurred. Inspect error.code.
1136+ * });
1137+ *
9941138 * @param {string } email The email address with the password to be reset.
1139+ * @param {?firebase.auth.ActionCodeSettings= } actionCodeSettings The action
1140+ * code settings. If specified, the state/continue URL will be set as the
1141+ * "continueUrl" parameter in the password reset link. The default password
1142+ * reset landing page will use this to display a link to go back to the app
1143+ * if it is installed.
1144+ * If the actionCodeSettings is not specified, no URL is appended to the
1145+ * action URL.
1146+ * The state URL provided must belong to a domain that is whitelisted by the
1147+ * developer in the console. Otherwise an error will be thrown.
1148+ * Mobile app redirects will only be applicable if the developer configures
1149+ * and accepts the Firebase Dynamic Links terms of condition.
1150+ * The Android package name and iOS bundle ID will be respected only if they
1151+ * are configured in the same Firebase Auth project used.
9951152 * @return {!firebase.Promise<void> }
9961153 */
997- firebase . auth . Auth . prototype . sendPasswordResetEmail = function ( email ) { } ;
1154+ firebase . auth . Auth . prototype . sendPasswordResetEmail =
1155+ function ( email , actionCodeSettings ) { } ;
9981156
9991157
10001158/**
0 commit comments