@@ -75,6 +75,45 @@ firebase.auth.AuthCredential = function() {};
75
75
*/
76
76
firebase . auth . AuthCredential . prototype . providerId ;
77
77
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
+
78
117
/**
79
118
* Gets the {@link firebase.auth.Auth `Auth`} service for the current app.
80
119
*
@@ -763,15 +802,40 @@ firebase.auth.ActionCodeInfo = function() {};
763
802
764
803
765
804
/**
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.
767
814
*
768
815
* @typedef {{
769
- * email: string
816
+ * email: (?string|undefined),
817
+ * fromEmail: (?string|undefined)
770
818
* }}
771
819
*/
772
820
firebase . auth . ActionCodeInfo . prototype . data ;
773
821
774
822
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
+
775
839
/**
776
840
* This is the interface that defines the required continue/state URL with
777
841
* optional Android and iOS bundle identifiers.
@@ -1630,6 +1694,87 @@ firebase.auth.AuthProvider = function() {};
1630
1694
firebase . auth . AuthProvider . prototype . providerId ;
1631
1695
1632
1696
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
+
1633
1778
/**
1634
1779
* Facebook auth provider.
1635
1780
*
@@ -1676,7 +1821,7 @@ firebase.auth.FacebookAuthProvider.PROVIDER_ID;
1676
1821
* );
1677
1822
*
1678
1823
* @param {string } token Facebook access token.
1679
- * @return {!firebase.auth.AuthCredential } The auth provider credential.
1824
+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
1680
1825
*/
1681
1826
firebase . auth . FacebookAuthProvider . credential = function ( token ) { } ;
1682
1827
@@ -1784,7 +1929,7 @@ firebase.auth.GithubAuthProvider.PROVIDER_ID;
1784
1929
* );
1785
1930
*
1786
1931
* @param {string } token Github access token.
1787
- * @return {!firebase.auth.AuthCredential } The auth provider credential.
1932
+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
1788
1933
*/
1789
1934
firebase . auth . GithubAuthProvider . credential = function ( token ) { } ;
1790
1935
@@ -1866,7 +2011,7 @@ firebase.auth.GoogleAuthProvider.PROVIDER_ID;
1866
2011
*
1867
2012
* @param {?string= } idToken Google ID token.
1868
2013
* @param {?string= } accessToken Google access token.
1869
- * @return {!firebase.auth.AuthCredential } The auth provider credential.
2014
+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
1870
2015
*/
1871
2016
firebase . auth . GoogleAuthProvider . credential = function ( idToken , accessToken ) { } ;
1872
2017
@@ -1939,7 +2084,7 @@ firebase.auth.TwitterAuthProvider.PROVIDER_ID;
1939
2084
/**
1940
2085
* @param {string } token Twitter access token.
1941
2086
* @param {string } secret Twitter secret.
1942
- * @return {!firebase.auth.AuthCredential } The auth provider credential.
2087
+ * @return {!firebase.auth.OAuthCredential } The auth provider credential.
1943
2088
*/
1944
2089
firebase . auth . TwitterAuthProvider . credential = function ( token , secret ) { } ;
1945
2090
0 commit comments