带有电子邮件和密码的Google Firebase身份验证不起作用 [英] Google Firebase Authentication with email and password does not work
问题描述
我安装了由Google开发的新的Firebase SDK,我尝试使用身份验证SDK创建一个新用户。但是,我完全按照文档所说的做了,但是不起作用。任何意见或建议?
我在RegisterUserViewController.h中拥有Authentication的代码
在AppDelegate.h中我还添加了[FIRApp配置]在应用程序中:didFinishLaunchingWithOptions;
以下是RegisterUserViewController.h的代码:
#importRegisterUserViewController.h
@import FirebaseAuth;
@import Firebase;
@import FirebaseMessaging;
@interface RegisterUserViewController()
@end
@implementation RegisterUserViewController
- (void)viewDidLoad {
[super viewDidLoad中];
$ b - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
//处理任何可以重新创建的资源。
$ b - (IBAction)createUserButton:(id)sender {
[[FIRAuth auth] createUserWithEmail:self.emailTextField.text password:self.passwordTextField。文本完成:^(FIRUser * _Nullable user,NSError * _Nullable error)
{
if(error == nil)
{
NSLog(@%@,user。电子邮件);
NSLog(@New user Created!);
[self performSegueWithIdentifier:@BackToLoginsender:nil];
}
else
{
NSLog(@%@,error);
}
}];
}
@end
这是我得到的错误:
$ b
错误域= FIRAuthErrorDomain代码= 17999发生内部错误,打印并检查错误详细信息以获取更多信息。 UserInfo = 0x7f98fc4609d0 {NSUnderlyingError = 0x7f98fc4cf790操作无法完成(FIRAuthInternalErrorDomain错误3.),error_name = ERROR_INTERNAL_ERROR,NSLocalizedDescription =发生内部错误,打印并检查错误的详细信息以获取更多信息。 >
我有相同的错误,并通过在Google控制台 https://console.developers.google.com/apis/api/identitytoolkit/overview?project=YOUR_PROJECT
I installed the new SDK of Firebase by Google and I am trying to create a new user using the Authentication SDK. However, I did exactly what the documentation says, but it does not work. Any comments or suggestions?
I have the code for Authentication in RegisterUserViewController.h
In AppDelegate.h I also added the [FIRApp configure] in application:didFinishLaunchingWithOptions;
Here is the code for RegisterUserViewController.h:
#import "RegisterUserViewController.h"
@import FirebaseAuth;
@import Firebase;
@import FirebaseMessaging;
@interface RegisterUserViewController ()
@end
@implementation RegisterUserViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)createUserButton:(id)sender {
[[FIRAuth auth] createUserWithEmail:self.emailTextField.text password:self.passwordTextField.text completion:^(FIRUser * _Nullable user, NSError * _Nullable error)
{
if(error == nil)
{
NSLog(@"%@", user.email);
NSLog(@"New user Created!");
[self performSegueWithIdentifier:@"BackToLogin" sender:nil];
}
else
{
NSLog(@"%@",error);
}
}];
}
@end
This is the error I get:
Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo=0x7f98fc4609d0 {NSUnderlyingError=0x7f98fc4cf790 "The operation couldn’t be completed. (FIRAuthInternalErrorDomain error 3.)", error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.}
I had the same error and solved it by activating the Identity Toolkit Api on Google Console https://console.developers.google.com/apis/api/identitytoolkit/overview?project=YOUR_PROJECT
这篇关于带有电子邮件和密码的Google Firebase身份验证不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!