我收到“FirebaseSimpleLogin:发生未知错误”在Firebase中尝试使用Twitter登录时 [英] I receive an "FirebaseSimpleLogin: An unknown error occurred" in Firebase when I try to log in with Twitter

查看:276
本文介绍了我收到“FirebaseSimpleLogin:发生未知错误”在Firebase中尝试使用Twitter登录时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我发现了Firebase并开始使用它。我部署了由Firebase提供的聊天应用程序的编辑版本(我刚刚更改了CSS),一切正常,直到我添加了Twitter日志记录选项。即使我按照这些说明操作,我仍然无法使用Twitter认证我的应用程序。 a>,然后从Twitter应用程序管理面板中激活使用Twitter登录。

这是我用来在我的聊天应用程序中登录的代码与我的代码中的Twitter日志记录相关):

pre $ //安装FirebaseSimpleLogin并监视用户的身份验证状态
var chatRef =新的Firebase('https://ranchat.firebaseIO.com');
var auth = new FirebaseSimpleLogin(chatRef,function(error,user){
if(error){
//尝试登录时发生错误
alert(error);
} else if(user){
//用户使用Firebase进行身份验证
alert('Welcome'+ user.username);
} else {
// user is注销
}
});

//尝试使用您的首选身份验证提供程序登录用户
$('#twlog')。click(function(){
auth.login('twitter' ,{
RememberMe:true
});
});

以下是我正在使用的Firebase规则

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

这就是在 $ b


错误:FirebaseSimpleLogin:发生未知错误


Honesly,我不知道为什么会这样。你可以给我一个手吗?

我发现解决方案感谢@RobDiMarco。



由于我的Firebase Forge中的Twitter API ID API Secret 的副本不正确,因此发生错误。我只需要复制这些,然后粘贴这里

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?

解决方案

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.

这篇关于我收到“FirebaseSimpleLogin:发生未知错误”在Firebase中尝试使用Twitter登录时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆