@@ -75,6 +75,45 @@ firebase.auth.AuthCredential = function() {};
7575 */
7676firebase . auth . AuthCredential . prototype . providerId ;
7777
78+
79+ /**
80+ * Interface that represents the OAuth credentials returned by an OAuth
81+ * provider. Implementations specify the details about each auth provider's
82+ * credential requirements.
83+ *
84+ * @interface
85+ * @extends {firebase.auth.AuthCredential }
86+ */
87+ firebase . auth . OAuthCredential = function ( ) { } ;
88+
89+
90+ /**
91+ * The OAuth ID token associated with the credential if it belongs to an
92+ * OIDC provider, such as `google.com`.
93+ *
94+ * @type {?string|undefined }
95+ */
96+ firebase . auth . OAuthCredential . prototype . idToken ;
97+
98+
99+ /**
100+ * The OAuth access token associated with the credential if it belongs to an
101+ * OAuth provider, such as `facebook.com`, `twitter.com`, etc.
102+ *
103+ * @type {?string|undefined }
104+ */
105+ firebase . auth . OAuthCredential . prototype . accessToken ;
106+
107+
108+ /**
109+ * The OAuth access token secret associated with the credential if it belongs
110+ * to an OAuth 1.0 provider, such as `twitter.com`.
111+ *
112+ * @type {?string|undefined }
113+ */
114+ firebase . auth . OAuthCredential . prototype . secret ;
115+
116+
78117/**
79118 * Gets the {@link firebase.auth.Auth `Auth`} service for the current app.
80119 *
@@ -763,15 +802,40 @@ firebase.auth.ActionCodeInfo = function() {};
763802
764803
765804/**
766- * The email address associated with the action code.
805+ * The data associated with the action code.
806+ *
807+ * For the PASSWORD_RESET, VERIFY_EMAIL, and RECOVER_EMAIL actions, this object
808+ * contains an `email` field with the address the email was sent to.
809+ *
810+ * For the RECOVER_EMAIL action, which allows a user to undo an email address
811+ * change, this object also contains a `fromEmail` field with the user account's
812+ * new email address. After the action completes, the user's email address will
813+ * revert to the value in the `email` field from the value in `fromEmail` field.
767814 *
768815 * @typedef {{
769- * email: string
816+ * email: (?string|undefined),
817+ * fromEmail: (?string|undefined)
770818 * }}
771819 */
772820firebase . auth . ActionCodeInfo . prototype . data ;
773821
774822
823+ /**
824+ * The type of operation that generated the action code. This could be:
825+ * <ul>
826+ * <li>`PASSWORD_RESET`: password reset code generated via
827+ * {@link firebase.auth.Auth#sendPasswordResetEmail}.</li>
828+ * <li>`VERIFY_EMAIL`: email verification code generated via
829+ * {@link firebase.User#sendEmailVerification}.</li>
830+ * <li>`RECOVER_EMAIL`: email change revocation code generated via
831+ * {@link firebase.User#updateEmail}.</li>
832+ * </ul>
833+ *
834+ * @type {string }
835+ */
836+ firebase . auth . ActionCodeInfo . prototype . operation ;
837+
838+
775839/**
776840 * This is the interface that defines the required continue/state URL with
777841 * optional Android and iOS bundle identifiers.
@@ -1630,6 +1694,87 @@ firebase.auth.AuthProvider = function() {};
16301694firebase . auth . AuthProvider . prototype . providerId ;
16311695
16321696
1697+ /**
1698+ * Generic OAuth provider.
1699+ *
1700+ * @example
1701+ * // Using a redirect.
1702+ * firebase.auth().getRedirectResult().then(function(result) {
1703+ * if (result.credential) {
1704+ * // This gives you the OAuth Access Token for that provider.
1705+ * var token = result.credential.accessToken;
1706+ * }
1707+ * var user = result.user;
1708+ * });
1709+ *
1710+ * // Start a sign in process for an unauthenticated user.
1711+ * var provider = new firebase.auth.OAuthProvider('google.com');
1712+ * provider.addScope('profile');
1713+ * provider.addScope('email');
1714+ * firebase.auth().signInWithRedirect(provider);
1715+ *
1716+ * @example
1717+ * // Using a popup.
1718+ * var provider = new firebase.auth.OAuthProvider('google.com');
1719+ * provider.addScope('profile');
1720+ * provider.addScope('email');
1721+ * firebase.auth().signInWithPopup(provider).then(function(result) {
1722+ * // This gives you the OAuth Access Token for that provider.
1723+ * var token = result.credential.accessToken;
1724+ * // The signed-in user info.
1725+ * var user = result.user;
1726+ * });
1727+ *
1728+ * @see {@link firebase.auth.Auth#onAuthStateChanged } to receive sign in state
1729+ * changes.
1730+ * @param {string } providerId The associated provider ID, such as `github.com`.
1731+ * @constructor
1732+ * @implements {firebase.auth.AuthProvider}
1733+ */
1734+ firebase . auth . OAuthProvider = function ( providerId ) { } ;
1735+
1736+ /**
1737+ * Creates a Firebase credential from a generic OAuth provider's access token or
1738+ * ID token.
1739+ *
1740+ * @example
1741+ * // `googleUser` from the onsuccess Google Sign In callback.
1742+ * // Initialize a generate OAuth provider with a `google.com` providerId.
1743+ * var provider = new firebase.auth.OAuthProvider('google.com');
1744+ * var credential = provider.credential(
1745+ * googleUser.getAuthResponse().id_token);
1746+ * firebase.auth().signInWithCredential(credential)
1747+ *
1748+ * @param {?string= } idToken The OAuth ID token if OIDC compliant.
1749+ * @param {?string= } accessToken The OAuth access token.
1750+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
1751+ */
1752+ firebase . auth . OAuthProvider . prototype . credential =
1753+ function ( idToken , accessToken ) { } ;
1754+
1755+ /** @type {string } */
1756+ firebase . auth . OAuthProvider . prototype . providerId ;
1757+
1758+ /**
1759+ * @param {string } scope Provider OAuth scope to add.
1760+ * @return {!firebase.auth.OAuthProvider } The provider instance.
1761+ */
1762+ firebase . auth . OAuthProvider . prototype . addScope = function ( scope ) { } ;
1763+
1764+ /**
1765+ * Sets the OAuth custom parameters to pass in an OAuth request for popup
1766+ * and redirect sign-in operations.
1767+ * For a detailed list, check the
1768+ * reserved required OAuth 2.0 parameters such as `client_id`, `redirect_uri`,
1769+ * `scope`, `response_type` and `state` are not allowed and will be ignored.
1770+ * @param {!Object } customOAuthParameters The custom OAuth parameters to pass
1771+ * in the OAuth request.
1772+ * @return {!firebase.auth.OAuthProvider } The provider instance.
1773+ */
1774+ firebase . auth . OAuthProvider . prototype . setCustomParameters =
1775+ function ( customOAuthParameters ) { } ;
1776+
1777+
16331778/**
16341779 * Facebook auth provider.
16351780 *
@@ -1676,7 +1821,7 @@ firebase.auth.FacebookAuthProvider.PROVIDER_ID;
16761821 * );
16771822 *
16781823 * @param {string } token Facebook access token.
1679- * @return {!firebase.auth.AuthCredential } The auth provider credential.
1824+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
16801825 */
16811826firebase . auth . FacebookAuthProvider . credential = function ( token ) { } ;
16821827
@@ -1784,7 +1929,7 @@ firebase.auth.GithubAuthProvider.PROVIDER_ID;
17841929 * );
17851930 *
17861931 * @param {string } token Github access token.
1787- * @return {!firebase.auth.AuthCredential } The auth provider credential.
1932+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
17881933 */
17891934firebase . auth . GithubAuthProvider . credential = function ( token ) { } ;
17901935
@@ -1866,7 +2011,7 @@ firebase.auth.GoogleAuthProvider.PROVIDER_ID;
18662011 *
18672012 * @param {?string= } idToken Google ID token.
18682013 * @param {?string= } accessToken Google access token.
1869- * @return {!firebase.auth.AuthCredential } The auth provider credential.
2014+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
18702015 */
18712016firebase . auth . GoogleAuthProvider . credential = function ( idToken , accessToken ) { } ;
18722017
@@ -1939,7 +2084,7 @@ firebase.auth.TwitterAuthProvider.PROVIDER_ID;
19392084/**
19402085 * @param {string } token Twitter access token.
19412086 * @param {string } secret Twitter secret.
1942- * @return {!firebase.auth.AuthCredential } The auth provider credential.
2087+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
19432088 */
19442089firebase . auth . TwitterAuthProvider . credential = function ( token , secret ) { } ;
19452090
0 commit comments