Constructor

TwitterAuthProvider

new TwitterAuthProvider()

Twitter auth provider.

Implements
firebase.auth.AuthProvider
See also
firebase.auth.Auth#onAuthStateChanged to receive sign in state changes.

Examples

// 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);
// 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;
});

Properties

PROVIDER_ID

static

string

providerId

string

Implements
firebase.auth.AuthProvider#providerId

Methods

credential

static

credential(token, secret) returns firebase.auth.AuthCredential

Parameter

token

string

Twitter access token.

secret

string

Twitter secret.

Returns

non-null firebase.auth.AuthCredential The auth provider credential.

setCustomParameters

setCustomParameters(customOAuthParameters) returns firebase.auth.AuthProvider

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.

Parameter

customOAuthParameters

Object

The custom OAuth parameters to pass in the OAuth request.

Value must not be null.

Returns

non-null firebase.auth.AuthProvider The provider instance itself.