@@ -75,6 +75,16 @@ firebase.auth.AuthCredential = function() {};
7575 */
7676firebase . auth . AuthCredential . prototype . providerId ;
7777
78+ /**
79+ * The authentication sign in method for the credential.
80+ * For example, 'password', or 'emailLink. This corresponds to the sign-in
81+ * method identifier as returned in
82+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
83+ *
84+ * @type {string }
85+ */
86+ firebase . auth . AuthCredential . prototype . signInMethod ;
87+
7888/**
7989 * Interface that represents the OAuth credentials returned by an OAuth
8090 * provider. Implementations specify the details about each auth provider's
@@ -843,6 +853,8 @@ firebase.auth.ActionCodeInfo.prototype.data;
843853 * {@link firebase.User#sendEmailVerification}.</li>
844854 * <li>`RECOVER_EMAIL`: email change revocation code generated via
845855 * {@link firebase.User#updateEmail}.</li>
856+ * <li>`EMAIL_SIGNIN`: email sign in code generated via
857+ * {@link firebase.auth.Auth#sendSignInLinkToEmail}.</li>
846858 * </ul>
847859 *
848860 * @type {string }
@@ -1165,6 +1177,31 @@ firebase.auth.Auth.prototype.createUserWithEmailAndPassword = function(
11651177 */
11661178firebase . auth . Auth . prototype . fetchProvidersForEmail = function ( email ) { } ;
11671179
1180+ /**
1181+ * Gets the list of possible sign in methods for the given email address. This
1182+ * is useful to differentiate methods of sign-in for the same provider,
1183+ * eg. `EmailAuthProvider` which has 2 methods of sign-in, email/password and
1184+ * email/link.
1185+ *
1186+ * <h4>Error Codes</h4>
1187+ * <dl>
1188+ * <dt>auth/invalid-email</dt>
1189+ * <dd>Thrown if the email address is not valid.</dd>
1190+ * </dl>
1191+ *
1192+ * @param {string } email An email address.
1193+ * @return {!firebase.Promise<!Array<string>> }
1194+ */
1195+ firebase . auth . Auth . prototype . fetchSignInMethodsForEmail = function ( email ) { } ;
1196+
1197+ /**
1198+ * Checks if an incoming link is a sign-in with email link.
1199+ *
1200+ * @param {string } emailLink Sign-in email link.
1201+ * @return {boolean } Whether the link is a sign-in with email link.
1202+ */
1203+ firebase . auth . Auth . prototype . isSignInWithEmailLink = function ( emailLink ) { } ;
1204+
11681205/**
11691206 * Adds an observer for changes to the user's sign-in state.
11701207 *
@@ -1222,6 +1259,82 @@ firebase.auth.Auth.prototype.onIdTokenChanged = function(
12221259 completed
12231260) { } ;
12241261
1262+ /**
1263+ * Sends a sign-in email link to the user with the specified email.
1264+ *
1265+ * The sign-in operation has to always be completed in the app unlike other out
1266+ * of band email actions (password reset and email verifications). This is
1267+ * because, at the end of the flow, the user is expected to be signed in and
1268+ * their Auth state persisted within the app.
1269+ *
1270+ * To complete sign in with the email link, call
1271+ * {@link firebase.auth.Auth#signInWithEmailLink} with the email address and
1272+ * the email link supplied in the email sent to the user.
1273+ *
1274+ * <h4>Error Codes</h4>
1275+ * <dl>
1276+ * <dt>auth/argument-error</dt>
1277+ * <dd>Thrown if handleCodeInApp is false.</dd>
1278+ * <dt>auth/invalid-email</dt>
1279+ * <dd>Thrown if the email address is not valid.</dd>
1280+ * <dt>auth/missing-android-pkg-name</dt>
1281+ * <dd>An Android package name must be provided if the Android app is required
1282+ * to be installed.</dd>
1283+ * <dt>auth/missing-continue-uri</dt>
1284+ * <dd>A continue URL must be provided in the request.</dd>
1285+ * <dt>auth/missing-ios-bundle-id</dt>
1286+ * <dd>An iOS Bundle ID must be provided if an App Store ID is provided.</dd>
1287+ * <dt>auth/invalid-continue-uri</dt>
1288+ * <dd>The continue URL provided in the request is invalid.</dd>
1289+ * <dt>auth/unauthorized-continue-uri</dt>
1290+ * <dd>The domain of the continue URL is not whitelisted. Whitelist
1291+ * the domain in the Firebase console.</dd>
1292+ * </dl>
1293+ *
1294+ * @example
1295+ * var actionCodeSettings = {
1296+ * // The URL to redirect to for sign-in completion. This is also the deep
1297+ * // link for mobile redirects. The domain (www.example.com) for this URL
1298+ * // must be whitelisted in the Firebase Console.
1299+ * url: 'https://www.example.com/finishSignUp?cartId=1234',
1300+ * iOS: {
1301+ * bundleId: 'com.example.ios'
1302+ * },
1303+ * android: {
1304+ * packageName: 'com.example.android',
1305+ * installApp: true,
1306+ * minimumVersion: '12'
1307+ * },
1308+ * // This must be true.
1309+ * handleCodeInApp: true
1310+ * };
1311+ * firebase.auth().sendSignInLinkToEmail('user@example.com', actionCodeSettings)
1312+ * .then(function() {
1313+ * // The link was successfully sent. Inform the user. Save the email
1314+ * // locally so you don't need to ask the user for it again if they open
1315+ * // the link on the same device.
1316+ * })
1317+ * .catch(function(error) {
1318+ * // Some error occurred, you can inspect the code: error.code
1319+ * });
1320+ *
1321+ * @param {string } email The email account to sign in with.
1322+ * @param {!firebase.auth.ActionCodeSettings } actionCodeSettings The action
1323+ * code settings. The action code settings which provides Firebase with
1324+ * instructions on how to construct the email link. This includes the
1325+ * sign in completion URL or the deep link for mobile redirects, the mobile
1326+ * apps to use when the sign-in link is opened on an Android or iOS device.
1327+ * Mobile app redirects will only be applicable if the developer configures
1328+ * and accepts the Firebase Dynamic Links terms of condition.
1329+ * The Android package name and iOS bundle ID will be respected only if they
1330+ * are configured in the same Firebase Auth project used.
1331+ * @return {!firebase.Promise<void> }
1332+ */
1333+ firebase . auth . Auth . prototype . sendSignInLinkToEmail = function (
1334+ email ,
1335+ actionCodeSettings
1336+ ) { } ;
1337+
12251338/**
12261339 * Sends a password reset email to the given email address.
12271340 *
@@ -1623,6 +1736,45 @@ firebase.auth.Auth.prototype.signInWithEmailAndPassword = function(
16231736 password
16241737) { } ;
16251738
1739+ /**
1740+ * Asynchronously signs in using an email and sign-in email link. If no link
1741+ * is passed, the link is inferred from the current URL.
1742+ *
1743+ * Fails with an error if the email address is invalid or OTP in email link
1744+ * expires.
1745+ *
1746+ * Note: Confirm the link is a sign-in email link before calling this method
1747+ * {@link firebase.auth.Auth#isSignInWithEmailLink}.
1748+ *
1749+ * <h4>Error Codes</h4>
1750+ * <dl>
1751+ * <dt>auth/expired-action-code</dt>
1752+ * <dd>Thrown if OTP in email link expires.</dd>
1753+ * <dt>auth/invalid-email</dt>
1754+ * <dd>Thrown if the email address is not valid.</dd>
1755+ * <dt>auth/user-disabled</dt>
1756+ * <dd>Thrown if the user corresponding to the given email has been
1757+ * disabled.</dd>
1758+ * </dl>
1759+ *
1760+ * @example
1761+ * firebase.auth().signInWithEmailLink(email, emailLink)
1762+ * .catch(function(error) {
1763+ * // Some error occurred, you can inspect the code: error.code
1764+ * // Common errors could be invalid email and invalid or expired OTPs.
1765+ * });
1766+ *
1767+ * @param {string } email The email account to sign in with.
1768+ * @param {?string= } emailLink The optional link which contains the OTP needed
1769+ * to complete the sign in with email link. If not specified, the current
1770+ * URL is used instead.
1771+ * @return {!firebase.Promise<!firebase.auth.UserCredential> }
1772+ */
1773+ firebase . auth . Auth . prototype . signInWithEmailLink = function (
1774+ email ,
1775+ emailLink
1776+ ) { } ;
1777+
16261778/**
16271779 * Asynchronously signs in using a phone number. This method sends a code via
16281780 * SMS to the given phone number, and returns a
@@ -2025,6 +2177,14 @@ firebase.auth.FacebookAuthProvider = function() {};
20252177/** @type {string } */
20262178firebase . auth . FacebookAuthProvider . PROVIDER_ID ;
20272179
2180+ /**
2181+ * This corresponds to the sign-in method identifier as returned in
2182+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2183+ *
2184+ * @type {string }
2185+ */
2186+ firebase . auth . FacebookAuthProvider . FACEBOOK_SIGN_IN_METHOD ;
2187+
20282188/**
20292189 * @example
20302190 * var cred = firebase.auth.FacebookAuthProvider.credential(
@@ -2133,6 +2293,14 @@ firebase.auth.GithubAuthProvider = function() {};
21332293/** @type {string } */
21342294firebase . auth . GithubAuthProvider . PROVIDER_ID ;
21352295
2296+ /**
2297+ * This corresponds to the sign-in method identifier as returned in
2298+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2299+ *
2300+ * @type {string }
2301+ */
2302+ firebase . auth . GithubAuthProvider . GITHUB_SIGN_IN_METHOD ;
2303+
21362304/**
21372305 * @example
21382306 * var cred = firebase.auth.FacebookAuthProvider.credential(
@@ -2211,6 +2379,14 @@ firebase.auth.GoogleAuthProvider = function() {};
22112379/** @type {string } */
22122380firebase . auth . GoogleAuthProvider . PROVIDER_ID ;
22132381
2382+ /**
2383+ * This corresponds to the sign-in method identifier as returned in
2384+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2385+ *
2386+ * @type {string }
2387+ */
2388+ firebase . auth . GoogleAuthProvider . GOOGLE_SIGN_IN_METHOD ;
2389+
22142390/**
22152391 * Creates a credential for Google. At least one of ID token and access token
22162392 * is required.
@@ -2293,6 +2469,14 @@ firebase.auth.TwitterAuthProvider = function() {};
22932469/** @type {string } */
22942470firebase . auth . TwitterAuthProvider . PROVIDER_ID ;
22952471
2472+ /**
2473+ * This corresponds to the sign-in method identifier as returned in
2474+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2475+ *
2476+ * @type {string }
2477+ */
2478+ firebase . auth . TwitterAuthProvider . TWITTER_SIGN_IN_METHOD ;
2479+
22962480/**
22972481 * @param {string } token Twitter access token.
22982482 * @param {string } secret Twitter secret.
@@ -2331,6 +2515,22 @@ firebase.auth.EmailAuthProvider = function() {};
23312515/** @type {string } */
23322516firebase . auth . EmailAuthProvider . PROVIDER_ID ;
23332517
2518+ /**
2519+ * This corresponds to the sign-in method identifier as returned in
2520+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2521+ *
2522+ * @type {string }
2523+ */
2524+ firebase . auth . EmailAuthProvider . EMAIL_PASSWORD_SIGN_IN_METHOD ;
2525+
2526+ /**
2527+ * This corresponds to the sign-in method identifier as returned in
2528+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2529+ *
2530+ * @type {string }
2531+ */
2532+ firebase . auth . EmailAuthProvider . EMAIL_LINK_SIGN_IN_METHOD ;
2533+
23342534/**
23352535 * @example
23362536 * var cred = firebase.auth.EmailAuthProvider.credential(
@@ -2344,6 +2544,25 @@ firebase.auth.EmailAuthProvider.PROVIDER_ID;
23442544 */
23452545firebase . auth . EmailAuthProvider . credential = function ( email , password ) { } ;
23462546
2547+ /**
2548+ * Initialize an `EmailAuthProvider` credential using an email and an email link
2549+ * after a sign in with email link operation.
2550+ *
2551+ * @example
2552+ * var cred = firebase.auth.EmailAuthProvider.credentialWithLink(
2553+ * email,
2554+ * emailLink
2555+ * );
2556+ *
2557+ * @param {string } email Email address.
2558+ * @param {string } emailLink Sign-in email link.
2559+ * @return {!firebase.auth.AuthCredential } The auth provider credential.
2560+ */
2561+ firebase . auth . EmailAuthProvider . credentialWithLink = function (
2562+ email ,
2563+ emailLink
2564+ ) { } ;
2565+
23472566/** @type {string } */
23482567firebase . auth . EmailAuthProvider . prototype . providerId ;
23492568
@@ -2376,6 +2595,14 @@ firebase.auth.PhoneAuthProvider = function(auth) {};
23762595/** @type {string } */
23772596firebase . auth . PhoneAuthProvider . PROVIDER_ID ;
23782597
2598+ /**
2599+ * This corresponds to the sign-in method identifier as returned in
2600+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
2601+ *
2602+ * @type {string }
2603+ */
2604+ firebase . auth . PhoneAuthProvider . PHONE_SIGN_IN_METHOD ;
2605+
23792606/**
23802607 * Creates a phone auth credential, given the verification ID from
23812608 * {@link firebase.auth.PhoneAuthProvider#verifyPhoneNumber} and the code
0 commit comments