Firebase OSX简单的用电子邮件登录/传递奇特 [英] Firebase OSX simple login with email/pass oddity

查看:165
本文介绍了Firebase OSX简单的用电子邮件登录/传递奇特的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SimpleLogin和电子邮件/密码认证为现有的Firebase设置了一个非常基本的OSX应用程序。



这是我使用的代码。 p>

   - (void)applicationDidFinishLaunching:(NSNotification *)notification {

Firebase * ref = [[Firebase alloc ] initWithUrl:@https://myapp.firebaseio.com];
FirebaseSimpleLogin * authClient = [[FirebaseSimpleLogin alloc] initWithRef:ref];

[authClient loginWithEmail:@myemail@mydomain.comandPassword:@mypassword
withCompletionBlock:^(NSError * error,FAUser * user){
$ b $ (b)if(error!= nil){
//登录到这个帐户时出错
NSLog(@authClient login error:%@,error);
} else {
NSLog(@Login success。);

}
}];

$ / code>

登录成功,我看到日志输出。但是,FAUser * user是零。怎么样?为什么?
在线搜索/现有的SO问题并没有帮助..

任何想法?

强**>更新**



iOS中的相同代码按预期工作。这只是一个OSX的问题吗?



**更新2 **

我直接在OSX项目中编译了Firebase / Objective-C简单登录服务(似乎只参考iOS)的源代码,发现登录服务尝试存储Keychain数据时出现重复项目错误代码OSX。

钥匙串保存操作之后的源代码然后继续返回一个空用户。我相信这里有一个逻辑错误,因为如果if语句不是成功代码(跳过重复项的特殊情况),if语句的计算结果为真:

 if(status!= noErr){
user = nil;
}
else if(status == errSecDuplicateItem){
// TODO:记录一个错误?
user = nil;





$ b

无论如何,我可以通过修改这一小块代码来继续工作符合我的需求。

解决方案

是的,你说得对。这是访问钥匙串的错误。



要清除自己机器上的错误,您可以访问钥匙串访问,在右上角搜索firebase。您应该获得名称 https://auth.firebase.com 的项目。点击它。检查帐户字段中的 Firebase_< YOUR_FIREBASE_NAME> ,然后继续删除。下次启动应用程序时,您必须重新登录。

当您尝试同时多次击中同一个钥匙串项目时,这似乎显示出来。多次缓慢地访问钥匙串似乎没有问题,除非有人正在同一台机器上验证许多相同的应用程序,否则不应该得到错误。 (如果你可以用其他方法,请分享!)


I'm setting up a very basic OSX app for an existing firebase with SimpleLogin and email/password authentication.

Here's the code I'm using.

- (void) applicationDidFinishLaunching:(NSNotification *)notification {

  Firebase* ref = [[Firebase alloc] initWithUrl:@"https://myapp.firebaseio.com"];
  FirebaseSimpleLogin* authClient = [[FirebaseSimpleLogin alloc] initWithRef:ref];

  [authClient loginWithEmail:@"myemail@mydomain.com" andPassword:@"mypassword"
       withCompletionBlock:^(NSError* error, FAUser* user) {

           if (error != nil) {
               // There was an error logging in to this account
               NSLog(@"authClient login error: %@", error);
           } else {
               NSLog(@"Login success.");

           }
       }];
}

Login is successful, and I see the log output. However, "FAUser* user" is nil. How? Why? Online search / existing SO questions haven't helped..

Any ideas?

** UPDATE **

Same code in iOS works as expected. Is this just an OSX issue?

** UPDATE 2 **

I compiled the source code from the Firebase/Objective-C Simple Login Service (which seems to only reference iOS) directly in my OSX project and found that there is a "duplicate item" error code when the login service tries to store Keychain data on OSX.

The source code after the keychain save operation then proceeds to return a null user. I believe there is a logic error here because the if statement evaluates to true whenever it is not a success code (skipping the special case for duplicate item):

if (status != noErr) {        
    user = nil;
}
else if (status == errSecDuplicateItem) {
    // TODO: log an error?
    user = nil;
}

Anyway, I am able to continue working by modifying this small chunk of code to fit my needs.

解决方案

Yeah, you're right. It's an error with accessing Keychain.

To clear the error on your own machine, you can go to Keychain Access, search for 'firebase' in the upper right. You should get an item with the name https://auth.firebase.com. Click it. Check that it says Firebase_<YOUR_FIREBASE_NAME> for the Account field, and go ahead and delete it. The next time you spin up your app, you'll have to log in again.

This seems to show up when you try to hit the same keychain item many times at once. Accessing the keychain slowly multiple times seems to be fine, so unless someone is authenticating many of the same app on the same machine, you shouldn't get the error. (If you can hit it some other way, please share!)

这篇关于Firebase OSX简单的用电子邮件登录/传递奇特的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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