我收到“FirebaseSimpleLogin:发生未知错误”在Firebase中尝试使用Twitter登录时 [英] I receive an "FirebaseSimpleLogin: An unknown error occurred" in Firebase when I try to log in with 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
}
}
}
错误: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屋!