I receive an "FirebaseSimpleLogin: An unknown error occurred" in Firebase when I try to log in with Twitter

StackOverflow https://stackoverflow.com/questions/22104121

Question

Yesterday, I discovered Firebase and started to use it. I deployed an edited version (I just changed the CSS) of the chat app provided by Firebase, Everything went OK until I added Twitter Logging option. I couldn't authenticate my app with Twitter even though I followed these instructions and I activated "Sign in with Twitter" from Twitter Application Management Panel.

This is the code I'm using in my chat app to log in (anything else is related to Twitter logging in my code):

// instatiate the FirebaseSimpleLogin and monitor the user's auth state
var chatRef = new Firebase('https://ranchat.firebaseIO.com');
var auth = new FirebaseSimpleLogin(chatRef, function(error, user) {
  if (error) {
// an error occurred while attempting login
alert(error);
  } else if (user) {
// user authenticated with Firebase
  alert('Welcome' + user.username);
  } else {
// user is logged out
  }
});

// attempt to log the user in with your preferred authentication provider
$('#twlog').click(function(){
  auth.login('twitter', {
  RememberMe: true
  });
});

These are the Firebase Rules I'm using

 {
 "rules": {
 ".read": true,
 "$comment": {
   ".write": "!data.exists() && newData.child('twitter_id').val() == auth.id"
   }
  }
 }

And this is what happens after press Twitter Log button in my app

Error: FirebaseSimpleLogin: An unknown error occurred

Honesly, I don't know why it happening. Would you give a hand?

Was it helpful?

Solution

I found the solution thanks to @RobDiMarco.

The error was occuring due to an incorrect copy of Twitter API ID and API Secret into my Firebase Forge. I just needed to copy these and then paste it here.

OTHER TIPS

The terminology is very confusing in Firebase Simple Login documentation. Firebase requires three things:

  • Twitter App ID (used in the client call), which is the "API key" from API keys tab in your Twitter application settings page
  • Twitter Consumer Key (entered into Firebase Forge), which is also the "API key"
  • Twitter Consumer Secret (entered into Firebase Forge), which is the "API secret" from the same tab
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top