Search code examples
javascriptfirebasetwitterfirebase-authenticationtwitter-oauth

Can't get Twitter to work with firebaseUI web


I'm using FirebaseUI for my website authentication. I got it to work easily enough with Google and Facebook, but for Twitter I get the following error message : "Unable to determine the authorization endpoint for the specified provider. This may be an issue in the provider configuration."

Here is my configuration:

// Initialize Firebase
var config = {
  apiKey: "<api key>",
  authDomain: "<app name>.firebaseapp.com",
  databaseURL: "https://<app name>.firebaseio.com",
  projectId: "<app name>",
  storageBucket: "<app name>.appspot.com",
  messagingSenderId: "<messaging sender ID>"
};
firebase.initializeApp(config);

/* Return firebaseUI configuration */
function getUiConfig (handleSignedInUser) {
  return {
    callbacks: {
      // Called when the user has been successfully signed in.
      signInSuccessWithAuthResult: function (authResult, redirectUrl) {
        if (authResult.user) {
          handleSignedInUser(authResult);
        }
      },
      uiShown: function () {
        $('#firebase-loading').hide();
        $('#firebase-loaded').show();
      }
    },
    signInOptions: [
      // Google
      {
        provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
        // Required to enable this provider in One-Tap Sign-up.
        authMethod: 'https://accounts.google.com',
        customParameters: {
          // Forces account selection even when there is only one account available.
          prompt: 'select_account'
        }
      },
      // Facebook
      {
        provider: firebase.auth.FacebookAuthProvider.PROVIDER_ID,
        scopes :['email'],
        customParameters: {
          // Forces password re-entry.
          auth_type: 'reauthenticate'
        }
      },
      // Twitter
      firebase.auth.TwitterAuthProvider.PROVIDER_ID,
      // E-mail
      {
        provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
        requireDisplayName: false
      }
    ]
  };
}

// Initialize the FirebaseUI Widget using Firebase.
var ui = new firebaseui.auth.AuthUI(firebase.auth());

And my account configuration on firebase:

firebase console


Solution

  • The error comes from the configuration of my twitter app. You have to go in the permissions tab of https://developer.twitter.com and check "Request email address from users" :

    twitter app configuration