diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..274dfde1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + branches: + - "**" + +env: + SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} + SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2-beta + with: + node-version: '18' + check-latest: true + - name: node_modules cache + id: node_modules_cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: ${{ runner.os }}-18-node_modules-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-18-node_modules- + - name: NPM install + if: steps.node_modules_cache.outputs.cache-hit != 'true' + run: npm ci + - name: Build & run tests + run: npm run test + - name: Run tests in Saucelabs + run: | + ./buildtools/sauce_connect.sh & + ./buildtools/run_tests.sh --saucelabs diff --git a/.gitignore b/.gitignore index bc5c909b..f716c972 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules/ generated/ out/ dist/ +.firebase # Generated files. *.log diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5321e20c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: node_js -node_js: - - '6' -install: npm install -script: npm test -- --saucelabs -before_install: - - export CHROME_BIN=/usr/bin/google-chrome - - sudo apt-get update - - sudo apt-get install -y libappindicator1 fonts-liberation - - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - - sudo dpkg -i google-chrome*.deb - - unset _JAVA_OPTIONS -services: - - xvfb -addons: - sauce_connect: true diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29b..5add5ae9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +* Fix password policy error message handling in password reset flow (#1047) diff --git a/README.md b/README.md index 0eae6df2..bf577643 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ FirebaseUI. 10. [React DOM Setup](#react-dom-setup) 11. [Angular Setup](#angular-setup) 12. [Known issues](#known-issues) -13. [Release Notes](#release-notes) +13. [Deprecated APIs](#deprecated-apis) +14. [Release Notes](#release-notes) ## Demo @@ -61,27 +62,27 @@ You just need to include the following script and CSS file in the `
` tag of your page, below the initialization snippet from the Firebase Console: ```html - - + + ``` #### Localized Widget -Localized versions of the widget are available through the CDN. To use a localized widget, load the -localized JS library instead of the default library: +Localized versions of the widget are available through the CDN. To use a +localized widget, load the localized JS library instead of the default library: ```html - - + + ``` where `{LANGUAGE_CODE}` is replaced by the code of the language you want. For example, the French version of the library is available at -`https://www.gstatic.com/firebasejs/ui/4.4.0/firebase-ui-auth__fr.js`. The list of available +`https://www.gstatic.com/firebasejs/ui/6.1.0/firebase-ui-auth__fr.js`. The list of available languages and their respective language codes can be found at [LANGUAGES.md](LANGUAGES.md). Right-to-left languages also require the right-to-left version of the stylesheet, available at -`https://www.gstatic.com/firebasejs/ui/4.4.0/firebase-ui-auth-rtl.css`, instead of the default +`https://www.gstatic.com/firebasejs/ui/6.1.0/firebase-ui-auth-rtl.css`, instead of the default stylesheet. The supported right-to-left languages are Arabic (ar), Farsi (fa), and Hebrew (iw). ### Option 2: npm Module @@ -90,25 +91,15 @@ Install FirebaseUI and its peer-dependency Firebase via npm using the following commands: ```bash -$ npm install firebase --save -$ npm install firebaseui --save +$ npm install firebase firebaseui --save ``` -You can then `require` the following modules within your source files: +You can then `import` the following modules within your source files: ```javascript -var firebase = require('firebase'); -var firebaseui = require('firebaseui'); -// or using ES6 imports: +import firebase from 'firebase/compat/app'; import * as firebaseui from 'firebaseui' -``` - -Or include the required files in your HTML, if your HTTP Server serves the files -within `node_modules/`: - -```html - - +import 'firebaseui/dist/firebaseui.css' ``` ### Option 3: Bower component @@ -139,9 +130,9 @@ FirebaseUI includes the following flows: *"One account per email address"* setting is enabled in the [Firebase console](https://console.firebase.google.com). This setting is enabled by default.) -6. [Account Chooser](https://www.accountchooser.com/learnmore.html?lang=en) for -remembering emails -7. Ability to upgrade anonymous users through sign-in/sign-up +6. Integration with +[one-tap sign-up](https://developers.google.com/identity/one-tap/web/) +7. Ability to upgrade anonymous users through sign-in/sign-up. 8. Sign-in as a guest ### Configuring sign-in providers @@ -172,7 +163,7 @@ instructions: ### Starting the sign-in flow You first need to initialize your -[Firebase app](https://firebase.google.com/docs/web/setup#prerequisites). The +[Firebase app](https://firebase.google.com/docs/web/setup). The `firebase.auth.Auth` instance should be passed to the constructor of `firebaseui.auth.AuthUI`. You can then call the `start` method with the CSS selector that determines where to create the widget, and a configuration object. @@ -191,12 +182,14 @@ for a more in-depth example, showcasing a Single Page Application mode.diff --git a/demo/public/sample-config.js b/demo/public/sample-config.js index 9d384888..4467c6d3 100644 --- a/demo/public/sample-config.js +++ b/demo/public/sample-config.js @@ -20,6 +20,8 @@ var config = { }; firebase.initializeApp(config); + // Google OAuth Client ID, needed to support One-tap sign-up. // Set to null if One-tap sign-up is not supported. -var CLIENT_ID = 'YOUR_OAUTH_CLIENT_ID'; +var CLIENT_ID = + 'YOUR_OAUTH_CLIENT_ID'; diff --git a/demo/public/widget.html b/demo/public/widget.html index 8cf9c106..1c2e9207 100644 --- a/demo/public/widget.html +++ b/demo/public/widget.html @@ -3,7 +3,8 @@
firebase
is a global namespace from which all the Firebase
+ * services are accessed.
+ *
+ * @namespace
+ */
+var firebase = {};
+
+/**
+ * Creates and initializes a Firebase {@link firebase.app.App app} instance.
+ *
+ * See
+ * {@link
+ * https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
+ * Add Firebase to your app} and
+ * {@link
+ * https://firebase.google.com/docs/web/setup#initialize_multiple_apps
+ * Initialize multiple apps} for detailed documentation.
+ *
+ * @example
+ * // Initialize default app
+ * // Retrieve your own options values by adding a web app on
+ * // https://console.firebase.google.com
+ * firebase.initializeApp({
+ * apiKey: "AIza....", // Auth / General Use
+ * authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
+ * databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
+ * storageBucket: "YOUR_APP.appspot.com", // Storage
+ * messagingSenderId: "123456789" // Cloud Messaging
+ * });
+ *
+ * @example
+ * // Initialize another app
+ * var otherApp = firebase.initializeApp({
+ * databaseURL: "https://.then()
or
+ * .catch()
methods.
+ *
+ * firebase.Promise
is the same as the native Promise
+ * implementation when available in the current environment, otherwise it is a
+ * compatible implementation of the Promise/A+ spec.
+ *
+ * @template T
+ * @constructor
+ * @implements {firebase.Thenable}
+ * @param {function((function(T): void),
+ * (function(!Error): void))} resolver
+ */
+firebase.Promise = function (resolver) {};
+
+/**
+ * Assign callback functions called when the Promise either resolves, or is
+ * rejected.
+ *
+ * @param {(function(T): *)=} onResolve Called when the Promise resolves.
+ * @param {(function(!Error): *)=} onReject Called when the Promise is rejected
+ * (with an error).
+ * @return {!firebase.Promise<*>}
+ * @override
+ */
+firebase.Promise.prototype.then = function (onResolve, onReject) {};
+
+/**
+ * Assign a callback when the Promise rejects.
+ *
+ * @param {(function(!Error): *)=} onReject Called when the Promise is rejected
+ * (with an error).
+ * @override
+ */
+firebase.Promise.prototype.catch = function (onReject) {};
+
+/**
+ * Return a resolved Promise.
+ *
+ * @template T
+ * @param {T=} value The value to be returned by the Promise.
+ * @return {!firebase.PromisePromise.all()
resolves only after all the Promises in the array
+ * have resolved.
+ *
+ * Promise.all()
rejects when any of the promises in the Array have
+ * rejected.
+ *
+ * @param {!Array>} values
+ * @return {!firebase.Promise>}
+ */
+firebase.Promise.all = function (values) {};
+
+/**
+ * @template V, E
+ * @interface
+ **/
+firebase.Observer = function () {};
+
+/**
+ * @param {?V} value
+ */
+firebase.Observer.prototype.next = function (value) {};
+
+/**
+ * @param {!E} error
+ */
+firebase.Observer.prototype.error = function (error) {};
+
+firebase.Observer.prototype.complete = function () {};
+
+/** @typedef {function(): void} */
+firebase.CompleteFn;
+
+/** @typedef {function(): void} */
+firebase.Unsubscribe;
+
+/**
+ * @param {string} name
+ * @param {string} version
+ * @param {?string} variant
+ */
+firebase.registerVersion = function (name, version, variant) {};
diff --git a/firebase-externs/firebase-auth-externs.js b/firebase-externs/firebase-auth-externs.js
new file mode 100644
index 00000000..f286f66c
--- /dev/null
+++ b/firebase-externs/firebase-auth-externs.js
@@ -0,0 +1,3471 @@
+/**
+ * @license Copyright 2017 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @fileoverview Firebase Auth API.
+ * @externs
+ */
+
+/**
+ * Gets the {@link firebase.auth.Auth `Auth`} service for the default app or a
+ * given app.
+ *
+ * `firebase.auth()` can be called with no arguments to access the default app's
+ * {@link firebase.auth.Auth `Auth`} service or as `firebase.auth(app)` to
+ * access the {@link firebase.auth.Auth `Auth`} service associated with a
+ * specific app.
+ *
+ * @example
+ * // Get the Auth service for the default app
+ * var defaultAuth = firebase.auth();
+ *
+ * @example
+ * // Get the Auth service for a given app
+ * var otherAuth = firebase.auth(otherApp);
+ *
+ * @namespace
+ * @param {!firebase.app.App=} app
+ *
+ * @return {!firebase.auth.Auth}
+ */
+firebase.auth = function (app) {};
+
+/**
+ * Interface that represents the credentials returned by an auth provider.
+ * Implementations specify the details about each auth provider's credential
+ * requirements.
+ *
+ * @interface
+ */
+firebase.auth.AuthCredential = function () {};
+
+/**
+ * The authentication provider ID for the credential.
+ * For example, 'facebook.com', or 'google.com'.
+ *
+ * @type {string}
+ */
+firebase.auth.AuthCredential.prototype.providerId;
+
+/**
+ * The authentication sign in method for the credential.
+ * For example, 'password', or 'emailLink. This corresponds to the sign-in
+ * method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.AuthCredential.prototype.signInMethod;
+
+/**
+ * Static method to deserialize a JSON representation of an object into an
+ * {@link firebase.auth.AuthCredential}. Input can be either Object or the
+ * stringified representation of the object. When string is provided,
+ * JSON.parse would be called first. If the JSON input does not represent an
+ * `AuthCredential`, null is returned.
+ * @param {string|!Object} json The plain object representation of an
+ * AuthCredential.
+ * @return {?firebase.auth.AuthCredential} The auth credential.
+ */
+firebase.auth.AuthCredential.fromJSON = function (json) {};
+
+/**
+ * Returns a JSON-serializable representation of this object.
+ * @return {!Object} The plain object representation of the `AuthCredential`.
+ */
+firebase.auth.AuthCredential.prototype.toJSON = function () {};
+
+/**
+ * Defines the options for initializing an
+ * {@link firebase.auth.OAuthCredential}. For ID tokens with nonce claim,
+ * the raw nonce has to also be provided.
+ *
+ * @interface
+ */
+firebase.auth.OAuthCredentialOptions = function () {};
+
+/**
+ * The OAuth ID token used to initialize the OAuthCredential.
+ *
+ * @type {string|undefined}
+ */
+firebase.auth.OAuthCredentialOptions.prototype.idToken;
+
+/**
+ * The OAuth access token used to initialize the OAuthCredential.
+ *
+ * @type {string|undefined}
+ */
+firebase.auth.OAuthCredentialOptions.prototype.accessToken;
+
+/**
+ * The raw nonce associated with the ID token. It is required when an ID token
+ * with a nonce field is provided. The SHA-256 hash of the raw nonce must match
+ * the nonce field in the ID token.
+ *
+ * @type {string|undefined}
+ */
+firebase.auth.OAuthCredentialOptions.prototype.rawNonce;
+
+/**
+ * Interface that represents the OAuth credentials returned by an OAuth
+ * provider. Implementations specify the details about each auth provider's
+ * credential requirements.
+ *
+ * @interface
+ * @extends {firebase.auth.AuthCredential}
+ */
+firebase.auth.OAuthCredential = function () {};
+
+/**
+ * The OAuth ID token associated with the credential if it belongs to an
+ * OIDC provider, such as `google.com`.
+ *
+ * @type {?string|undefined}
+ */
+firebase.auth.OAuthCredential.prototype.idToken;
+
+/**
+ * The OAuth access token associated with the credential if it belongs to an
+ * OAuth provider, such as `facebook.com`, `twitter.com`, etc.
+ *
+ * @type {?string|undefined}
+ */
+firebase.auth.OAuthCredential.prototype.accessToken;
+
+/**
+ * The OAuth access token secret associated with the credential if it belongs
+ * to an OAuth 1.0 provider, such as `twitter.com`.
+ *
+ * @type {?string|undefined}
+ */
+firebase.auth.OAuthCredential.prototype.secret;
+
+/**
+ * Interface that represents the phone credentials returned by a phone provider.
+ *
+ * @interface
+ * @extends {firebase.auth.AuthCredential}
+ */
+firebase.auth.PhoneAuthCredential = function () {};
+
+/**
+ * Gets the {@link firebase.auth.Auth `Auth`} service for the current app.
+ *
+ * @example
+ * var auth = app.auth();
+ * // The above is shorthand for:
+ * // var auth = firebase.auth(app);
+ *
+ * @return {!firebase.auth.Auth}
+ */
+firebase.app.App.prototype.auth = function () {};
+
+/**
+ * Interface representing a user's metadata.
+ *
+ * @interface
+ */
+firebase.auth.UserMetadata = function () {};
+
+/**
+ * The date the user last signed in, formatted as a UTC string.
+ * For example, 'Fri, 22 Sep 2017 01:49:58 GMT'.
+ *
+ * @type {?string}
+ */
+firebase.auth.UserMetadata.prototype.lastSignInTime;
+
+/**
+ * The date the user was created, formatted as a UTC string.
+ * For example, 'Fri, 22 Sep 2017 01:49:58 GMT'.
+ *
+ * @type {?string}
+ */
+firebase.auth.UserMetadata.prototype.creationTime;
+
+/**
+ * User profile information, visible only to the Firebase project's
+ * apps.
+ *
+ * @interface
+ */
+firebase.UserInfo = function () {};
+
+/**
+ * The user's unique ID.
+ *
+ * @type {string}
+ */
+firebase.UserInfo.prototype.uid;
+
+/**
+ * The authentication provider ID for the current user.
+ * For example, 'facebook.com', or 'google.com'.
+ *
+ * @type {string}
+ */
+firebase.UserInfo.prototype.providerId;
+
+/**
+ * The user's email address (if available).
+ * @type {?string}
+ */
+firebase.UserInfo.prototype.email;
+
+/**
+ * The user's display name (if available).
+ *
+ * @type {?string}
+ */
+firebase.UserInfo.prototype.displayName;
+
+/**
+ * The URL of the user's profile picture (if available).
+ *
+ * @type {?string}
+ */
+firebase.UserInfo.prototype.photoURL;
+
+/**
+ * The user's E.164 formatted phone number (if available).
+ *
+ * @type {?string}
+ */
+firebase.UserInfo.prototype.phoneNumber;
+
+/**
+ * A user account.
+ *
+ * @interface
+ * @extends {firebase.UserInfo}
+ */
+firebase.User = function () {};
+
+/**
+ * The phone number normalized based on the E.164 standard (e.g. +16505550101)
+ * for the current user. This is null if the user has no phone credential linked
+ * to the account.
+ * @type {?string}
+ */
+firebase.User.prototype.phoneNumber;
+
+/** @type {boolean} */
+firebase.User.prototype.isAnonymous;
+
+/**
+ * True if the user's email address has been verified.
+ * @type {boolean}
+ */
+firebase.User.prototype.emailVerified;
+
+/**
+ * Additional metadata about the user.
+ * @type {!firebase.auth.UserMetadata}
+ */
+firebase.User.prototype.metadata;
+
+/**
+ * Additional provider-specific information about the user.
+ * @type {!Arrayerror.email
, error.phoneNumber
, and
+ * error.credential
({@link firebase.auth.AuthCredential})
+ * may be provided, depending on the type of credential. You can recover
+ * from this error by signing in with error.credential
directly
+ * via {@link firebase.auth.Auth#signInWithCredential}.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided.
+ * You have to link the credential to the existing user with that email if
+ * you wish to continue signing in with that credential. To do so, call
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}, sign in to
+ * error.email
via one of the providers returned and then
+ * {@link firebase.User#linkWithCredential} the original credential to that
+ * newly signed in user.error.email
, error.phoneNumber
, and
+ * error.credential
({@link firebase.auth.AuthCredential})
+ * may be provided, depending on the type of credential. You can recover
+ * from this error by signing in with error.credential
directly
+ * via {@link firebase.auth.Auth#signInWithCredential}.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided.
+ * You have to link the credential to the existing user with that email if
+ * you wish to continue signing in with that credential. To do so, call
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}, sign in to
+ * error.email
via one of the providers returned and then
+ * {@link firebase.User#linkWithCredential} the original credential to that
+ * newly signed in user.error.phoneNumber
and
+ * error.credential
({@link firebase.auth.AuthCredential})
+ * are provided in this case. You can recover from this error by signing in
+ * with that credential directly via
+ * {@link firebase.auth.Auth#signInWithCredential}.url: Sets the link continue/state URL, which has different meanings + * in different contexts:
+ *error.email
, error.phoneNumber
, and
+ * error.credential
({@link firebase.auth.AuthCredential})
+ * may be provided, depending on the type of credential. You can recover
+ * from this error by signing in with error.credential
directly
+ * via {@link firebase.auth.Auth.signInWithCredential}.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided.
+ * You have to link the credential to the existing user with that email if
+ * you wish to continue signing in with that credential. To do so, call
+ * {@link firebase.auth.Auth.fetchSignInMethodsForEmail}, sign in to
+ * error.email
via one of the providers returned and then
+ * {@link firebase.User.linkWithCredential} the original credential to that
+ * newly signed in user.auth/multi-factor-auth-required
.
+ * This error provides a {@link firebase.auth.MultiFactorResolver} object,
+ * which you can use to get the second sign-in factor from the user.
+ *
+ * @example
+ * ```javascript
+ * firebase.auth().signInWithEmailAndPassword()
+ * .then(function(result) {
+ * // User signed in. No 2nd factor challenge is needed.
+ * })
+ * .catch(function(error) {
+ * if (error.code == 'auth/multi-factor-auth-required') {
+ * var resolver = error.resolver;
+ * var multiFactorHints = resolver.hints;
+ * } else {
+ * // Handle other errors.
+ * }
+ * });
+ *
+ * resolver.resolveSignIn(multiFactorAssertion)
+ * .then(function(userCredential) {
+ * // User signed in.
+ * });
+ * ```
+ *
+ * @interface
+ * @extends {firebase.auth.Error}
+ */
+firebase.auth.MultiFactorError = function () {};
+
+/**
+ * The multi-factor resolver to complete second factor sign-in.
+ *
+ * @type {!firebase.auth.MultiFactorResolver}
+ */
+firebase.auth.MultiFactorError.prototype.resolver;
+
+//
+// List of Auth Providers.
+//
+
+/**
+ * Interface that represents an auth provider.
+ *
+ * @interface
+ */
+firebase.auth.AuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.AuthProvider.prototype.providerId;
+
+/**
+ * Generic OAuth provider.
+ *
+ * @example
+ * // Using a redirect.
+ * firebase.auth().getRedirectResult().then(function(result) {
+ * if (result.credential) {
+ * // This gives you the OAuth Access Token for that provider.
+ * var token = result.credential.accessToken;
+ * }
+ * var user = result.user;
+ * });
+ *
+ * // Start a sign in process for an unauthenticated user.
+ * var provider = new firebase.auth.OAuthProvider('google.com');
+ * provider.addScope('profile');
+ * provider.addScope('email');
+ * firebase.auth().signInWithRedirect(provider);
+ *
+ * @example
+ * // Using a popup.
+ * var provider = new firebase.auth.OAuthProvider('google.com');
+ * provider.addScope('profile');
+ * provider.addScope('email');
+ * firebase.auth().signInWithPopup(provider).then(function(result) {
+ * // This gives you the OAuth Access Token for that provider.
+ * var token = result.credential.accessToken;
+ * // The signed-in user info.
+ * var user = result.user;
+ * });
+ *
+ * @see {@link firebase.auth.Auth#onAuthStateChanged} to receive sign in state
+ * changes.
+ * @param {string} providerId The associated provider ID, such as `github.com`.
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.OAuthProvider = function (providerId) {};
+
+/**
+ * Creates a Firebase credential from a generic OAuth provider's access token or
+ * ID token. The raw nonce is required when an ID token with a nonce field is
+ * provided. The SHA-256 hash of the raw nonce must match the nonce field in
+ * the ID token.
+ *
+ * @example
+ * // `googleUser` from the onsuccess Google Sign In callback.
+ * // Initialize a generate OAuth provider with a `google.com` providerId.
+ * var provider = new firebase.auth.OAuthProvider('google.com');
+ * var credential = provider.credential({
+ * idToken: googleUser.getAuthResponse().id_token,
+ * });
+ * firebase.auth().signInWithCredential(credential)
+ *
+ * @param {?firebase.auth.OAuthCredentialOptions|string} optionsOrIdToken Either
+ * the options object containing the ID token, access token and raw nonce or
+ * the ID token string.
+ * @param {?string=} accessToken The OAuth access token.
+ * @return {!firebase.auth.OAuthCredential} The auth provider credential.
+ */
+firebase.auth.OAuthProvider.prototype.credential = function (
+ optionsOrIdToken,
+ accessToken
+) {};
+
+/** @type {string} */
+firebase.auth.OAuthProvider.prototype.providerId;
+
+/**
+ * @param {string} scope Provider OAuth scope to add.
+ * @return {!firebase.auth.OAuthProvider} The provider instance.
+ */
+firebase.auth.OAuthProvider.prototype.addScope = function (scope) {};
+
+/**
+ * Sets the OAuth custom parameters to pass in an OAuth request for popup
+ * and redirect sign-in operations.
+ * For a detailed list, check the
+ * reserved required OAuth 2.0 parameters such as `client_id`, `redirect_uri`,
+ * `scope`, `response_type` and `state` are not allowed and will be ignored.
+ * @param {!Object} customOAuthParameters The custom OAuth parameters to pass
+ * in the OAuth request.
+ * @return {!firebase.auth.OAuthProvider} The provider instance.
+ */
+firebase.auth.OAuthProvider.prototype.setCustomParameters = function (
+ customOAuthParameters
+) {};
+
+/**
+ * Facebook auth provider.
+ *
+ * @example
+ * // Sign in using a redirect.
+ * firebase.auth().getRedirectResult().then(function(result) {
+ * if (result.credential) {
+ * // This gives you a Google Access Token.
+ * var token = result.credential.accessToken;
+ * }
+ * var user = result.user;
+ * })
+ * // Start a sign in process for an unauthenticated user.
+ * var provider = new firebase.auth.FacebookAuthProvider();
+ * provider.addScope('user_birthday');
+ * firebase.auth().signInWithRedirect(provider);
+ *
+ * @example
+ * // Sign in using a popup.
+ * var provider = new firebase.auth.FacebookAuthProvider();
+ * provider.addScope('user_birthday');
+ * firebase.auth().signInWithPopup(provider).then(function(result) {
+ * // This gives you a Facebook Access Token.
+ * var token = result.credential.accessToken;
+ * // The signed-in user info.
+ * var user = result.user;
+ * });
+ *
+ * @see {@link firebase.auth.Auth#onAuthStateChanged} to receive sign in state
+ * changes.
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.FacebookAuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.FacebookAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD;
+
+/**
+ * @example
+ * var cred = firebase.auth.FacebookAuthProvider.credential(
+ * // `event` from the Facebook auth.authResponseChange callback.
+ * event.authResponse.accessToken
+ * );
+ *
+ * @param {string} token Facebook access token.
+ * @return {!firebase.auth.OAuthCredential} The auth provider credential.
+ */
+firebase.auth.FacebookAuthProvider.credential = function (token) {};
+
+/** @type {string} */
+firebase.auth.FacebookAuthProvider.prototype.providerId;
+
+/**
+ * @param {string} scope Facebook OAuth scope.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.FacebookAuthProvider.prototype.addScope = function (scope) {};
+
+/**
+ * Sets the OAuth custom parameters to pass in a Facebook OAuth request for
+ * popup and redirect sign-in operations.
+ * Valid parameters include 'auth_type', 'display' and 'locale'.
+ * For a detailed list, check the
+ * {@link https://goo.gl/pve4fo Facebook}
+ * documentation.
+ * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri',
+ * 'scope', 'response_type' and 'state' are not allowed and will be ignored.
+ * @param {!Object} customOAuthParameters The custom OAuth parameters to pass
+ * in the OAuth request.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.FacebookAuthProvider.prototype.setCustomParameters = function (
+ customOAuthParameters
+) {};
+
+/**
+ * Github auth provider.
+ *
+ * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect
+ * directly, or use the signInWithPopup handler:
+ *
+ * @example
+ * // Using a redirect.
+ * firebase.auth().getRedirectResult().then(function(result) {
+ * if (result.credential) {
+ * // This gives you a GitHub Access Token.
+ * var token = result.credential.accessToken;
+ * }
+ * var user = result.user;
+ * }).catch(function(error) {
+ * // Handle Errors here.
+ * var errorCode = error.code;
+ * var errorMessage = error.message;
+ * // The email of the user's account used.
+ * var email = error.email;
+ * // The firebase.auth.AuthCredential type that was used.
+ * var credential = error.credential;
+ * if (errorCode === 'auth/account-exists-with-different-credential') {
+ * alert('You have signed up with a different provider for that email.');
+ * // Handle linking here if your app allows it.
+ * } else {
+ * console.error(error);
+ * }
+ * });
+ *
+ * // Start a sign in process for an unauthenticated user.
+ * var provider = new firebase.auth.GithubAuthProvider();
+ * provider.addScope('repo');
+ * firebase.auth().signInWithRedirect(provider);
+ *
+ * @example
+ * // With popup.
+ * var provider = new firebase.auth.GithubAuthProvider();
+ * provider.addScope('repo');
+ * firebase.auth().signInWithPopup(provider).then(function(result) {
+ * // This gives you a GitHub Access Token.
+ * var token = result.credential.accessToken;
+ * // The signed-in user info.
+ * var user = result.user;
+ * }).catch(function(error) {
+ * // Handle Errors here.
+ * var errorCode = error.code;
+ * var errorMessage = error.message;
+ * // The email of the user's account used.
+ * var email = error.email;
+ * // The firebase.auth.AuthCredential type that was used.
+ * var credential = error.credential;
+ * if (errorCode === 'auth/account-exists-with-different-credential') {
+ * alert('You have signed up with a different provider for that email.');
+ * // Handle linking here if your app allows it.
+ * } else {
+ * console.error(error);
+ * }
+ * });
+ *
+ * @see {@link firebase.auth.Auth#onAuthStateChanged} to receive sign in state
+ * changes.
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.GithubAuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.GithubAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.GithubAuthProvider.GITHUB_SIGN_IN_METHOD;
+
+/**
+ * @example
+ * var cred = firebase.auth.FacebookAuthProvider.credential(
+ * // `event` from the Facebook auth.authResponseChange callback.
+ * event.authResponse.accessToken
+ * );
+ *
+ * @param {string} token Github access token.
+ * @return {!firebase.auth.OAuthCredential} The auth provider credential.
+ */
+firebase.auth.GithubAuthProvider.credential = function (token) {};
+
+/** @type {string} */
+firebase.auth.GithubAuthProvider.prototype.providerId;
+
+/**
+ * @param {string} scope Github OAuth scope.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.GithubAuthProvider.prototype.addScope = function (scope) {};
+
+/**
+ * Sets the OAuth custom parameters to pass in a GitHub OAuth request for popup
+ * and redirect sign-in operations.
+ * Valid parameters include 'allow_signup'.
+ * For a detailed list, check the
+ * {@link https://developer.github.com/v3/oauth/ GitHub} documentation.
+ * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri',
+ * 'scope', 'response_type' and 'state' are not allowed and will be ignored.
+ * @param {!Object} customOAuthParameters The custom OAuth parameters to pass
+ * in the OAuth request.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.GithubAuthProvider.prototype.setCustomParameters = function (
+ customOAuthParameters
+) {};
+
+/**
+ * Google auth provider.
+ *
+ * @example
+ * // Using a redirect.
+ * firebase.auth().getRedirectResult().then(function(result) {
+ * if (result.credential) {
+ * // This gives you a Google Access Token.
+ * var token = result.credential.accessToken;
+ * }
+ * var user = result.user;
+ * });
+ *
+ * // Start a sign in process for an unauthenticated user.
+ * var provider = new firebase.auth.GoogleAuthProvider();
+ * provider.addScope('profile');
+ * provider.addScope('email');
+ * firebase.auth().signInWithRedirect(provider);
+ *
+ * @example
+ * // Using a popup.
+ * var provider = new firebase.auth.GoogleAuthProvider();
+ * provider.addScope('profile');
+ * provider.addScope('email');
+ * firebase.auth().signInWithPopup(provider).then(function(result) {
+ * // This gives you a Google Access Token.
+ * var token = result.credential.accessToken;
+ * // The signed-in user info.
+ * var user = result.user;
+ * });
+ *
+ * @see {@link firebase.auth.Auth#onAuthStateChanged} to receive sign in state
+ * changes.
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.GoogleAuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.GoogleAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD;
+
+/**
+ * Creates a credential for Google. At least one of ID token and access token
+ * is required.
+ *
+ * @example
+ * // `googleUser` from the onsuccess Google Sign In callback.
+ * var credential = firebase.auth.GoogleAuthProvider.credential(
+ googleUser.getAuthResponse().id_token);
+ * firebase.auth().signInWithCredential(credential)
+ *
+ * @param {?string=} idToken Google ID token.
+ * @param {?string=} accessToken Google access token.
+ * @return {!firebase.auth.OAuthCredential} The auth provider credential.
+ */
+firebase.auth.GoogleAuthProvider.credential = function (
+ idToken,
+ accessToken
+) {};
+
+/** @type {string} */
+firebase.auth.GoogleAuthProvider.prototype.providerId;
+
+/**
+ * @param {string} scope Google OAuth scope.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.GoogleAuthProvider.prototype.addScope = function (scope) {};
+
+/**
+ * Sets the OAuth custom parameters to pass in a Google OAuth request for popup
+ * and redirect sign-in operations.
+ * Valid parameters include 'hd', 'hl', 'include_granted_scopes', 'login_hint'
+ * and 'prompt'.
+ * For a detailed list, check the
+ * {@link https://goo.gl/Xo01Jm Google}
+ * documentation.
+ * Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri',
+ * 'scope', 'response_type' and 'state' are not allowed and will be ignored.
+ * @param {!Object} customOAuthParameters The custom OAuth parameters to pass
+ * in the OAuth request.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.GoogleAuthProvider.prototype.setCustomParameters = function (
+ customOAuthParameters
+) {};
+
+/**
+ * Twitter auth provider.
+ *
+ * @example
+ * // Using a redirect.
+ * firebase.auth().getRedirectResult().then(function(result) {
+ * if (result.credential) {
+ * // For accessing the Twitter API.
+ * var token = result.credential.accessToken;
+ * var secret = result.credential.secret;
+ * }
+ * var user = result.user;
+ * });
+ *
+ * // Start a sign in process for an unauthenticated user.
+ * var provider = new firebase.auth.TwitterAuthProvider();
+ * firebase.auth().signInWithRedirect(provider);
+ *
+ * @example
+ * // Using a popup.
+ * var provider = new firebase.auth.TwitterAuthProvider();
+ * firebase.auth().signInWithPopup(provider).then(function(result) {
+ * // For accessing the Twitter API.
+ * var token = result.credential.accessToken;
+ * var secret = result.credential.secret;
+ * // The signed-in user info.
+ * var user = result.user;
+ * });
+ *
+ * @see {@link firebase.auth.Auth#onAuthStateChanged} to receive sign in state
+ * changes.
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.TwitterAuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.TwitterAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.TwitterAuthProvider.TWITTER_SIGN_IN_METHOD;
+
+/**
+ * @param {string} token Twitter access token.
+ * @param {string} secret Twitter secret.
+ * @return {!firebase.auth.OAuthCredential} The auth provider credential.
+ */
+firebase.auth.TwitterAuthProvider.credential = function (token, secret) {};
+
+/** @type {string} */
+firebase.auth.TwitterAuthProvider.prototype.providerId;
+
+/**
+ * Sets the OAuth custom parameters to pass in a Twitter OAuth request for popup
+ * and redirect sign-in operations.
+ * Valid parameters include 'lang'.
+ * Reserved required OAuth 1.0 parameters such as 'oauth_consumer_key',
+ * 'oauth_token', 'oauth_signature', etc are not allowed and will be ignored.
+ * @param {!Object} customOAuthParameters The custom OAuth parameters to pass
+ * in the OAuth request.
+ * @return {!firebase.auth.AuthProvider} The provider instance itself.
+ */
+firebase.auth.TwitterAuthProvider.prototype.setCustomParameters = function (
+ customOAuthParameters
+) {};
+
+/**
+ * Email and password auth provider implementation.
+ *
+ * To authenticate: {@link firebase.auth.Auth#createUserWithEmailAndPassword}
+ * and {@link firebase.auth.Auth#signInWithEmailAndPassword}.
+ *
+ * @constructor
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.EmailAuthProvider = function () {};
+
+/** @type {string} */
+firebase.auth.EmailAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD;
+
+/**
+ * @example
+ * var cred = firebase.auth.EmailAuthProvider.credential(
+ * email,
+ * password
+ * );
+ *
+ * @param {string} email Email address.
+ * @param {string} password User account password.
+ * @return {!firebase.auth.AuthCredential} The auth provider credential.
+ */
+firebase.auth.EmailAuthProvider.credential = function (email, password) {};
+
+/**
+ * Initialize an `EmailAuthProvider` credential using an email and an email link
+ * after a sign in with email link operation.
+ *
+ * @example
+ * var cred = firebase.auth.EmailAuthProvider.credentialWithLink(
+ * email,
+ * emailLink
+ * );
+ *
+ * @param {string} email Email address.
+ * @param {string} emailLink Sign-in email link.
+ * @return {!firebase.auth.AuthCredential} The auth provider credential.
+ */
+firebase.auth.EmailAuthProvider.credentialWithLink = function (
+ email,
+ emailLink
+) {};
+
+/** @type {string} */
+firebase.auth.EmailAuthProvider.prototype.providerId;
+
+/**
+ * Phone number auth provider.
+ *
+ * @example
+ * // 'recaptcha-container' is the ID of an element in the DOM.
+ * var applicationVerifier = new firebase.auth.RecaptchaVerifier(
+ * 'recaptcha-container');
+ * var provider = new firebase.auth.PhoneAuthProvider();
+ * provider.verifyPhoneNumber('+16505550101', applicationVerifier)
+ * .then(function(verificationId) {
+ * var verificationCode = window.prompt('Please enter the verification ' +
+ * 'code that was sent to your mobile device.');
+ * return firebase.auth.PhoneAuthProvider.credential(verificationId,
+ * verificationCode);
+ * })
+ * .then(function(phoneCredential) {
+ * return firebase.auth().signInWithCredential(phoneCredential);
+ * });
+ *
+ * @constructor
+ * @param {?firebase.auth.Auth=} auth The Firebase Auth instance in which
+ * sign-ins should occur. Uses the default Auth instance if unspecified.
+ * @implements {firebase.auth.AuthProvider}
+ */
+firebase.auth.PhoneAuthProvider = function (auth) {};
+
+/** @type {string} */
+firebase.auth.PhoneAuthProvider.PROVIDER_ID;
+
+/**
+ * This corresponds to the sign-in method identifier as returned in
+ * {@link firebase.auth.Auth#fetchSignInMethodsForEmail}.
+ *
+ * @type {string}
+ */
+firebase.auth.PhoneAuthProvider.PHONE_SIGN_IN_METHOD;
+
+/**
+ * Creates a phone auth credential, given the verification ID from
+ * {@link firebase.auth.PhoneAuthProvider#verifyPhoneNumber} and the code
+ * that was sent to the user's mobile device.
+ *
+ * enrolledFactors()
)
+ * or the factor's UID string.
+ * Sessions are not revoked when the account is downgraded. An email
+ * notification is likely to be sent to the user notifying them of the change.
+ * Recent re-authentication is required for this operation to succeed.
+ * When an existing factor is unenrolled, an email notification is sent to the
+ * user’s email.
+ *
+ * error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided. You can
+ * recover from this error by signing in with that credential directly via
+ * {@link firebase.auth.Auth#signInWithCredential}.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided.
+ * You have to link the credential to the existing user with that email if
+ * you wish to continue signing in with that credential. To do so, call
+ * {@link firebase.auth.Auth#fetchProvidersForEmail}, sign in to
+ * error.email
via one of the providers returned and then
+ * {@link firebase.User#linkWithCredential} the original credential to that
+ * newly signed in user.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided. You can
+ * recover from this error by signing in with that credential directly via
+ * {@link firebase.auth.Auth#signInWithCredential}.error.email
and error.credential
+ * ({@link firebase.auth.AuthCredential}) fields are also provided.
+ * You have to link the credential to the existing user with that email if
+ * you wish to continue signing in with that credential. To do so, call
+ * {@link firebase.auth.Auth#fetchProvidersForEmail}, sign in to
+ * error.email
via one of the providers returned and then
+ * {@link firebase.User#linkWithCredential} the original credential to that
+ * newly signed in user.