Implements
Index
Constructors
constructor
Parameters
providerId: string
Returns OAuthProvider
Properties
providerId
Methods
addScope
Parameters
scope: string
Provider OAuth scope to add.
Returns AuthProvider
credential
Parameters
optionsOrIdToken: OAuthCredentialOptions | string | null
Either the options object containing the ID token, access token and raw nonce or the ID token string.
Optional accessToken: string
The OAuth access token.
Returns OAuthCredential
setCustomParameters
Parameters
customOAuthParameters: Object
The custom OAuth parameters to pass in the OAuth request.
Returns AuthProvider
// 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);
// 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; });
firebase.auth.Auth.onAuthStateChanged to receive sign in state changes.
The associated provider ID, such as
.com
.