使用电子邮件和密码的 Google Firebase 身份验证不起作用 [英] Google Firebase Authentication with email and password does not work
问题描述
我安装了 Google 的 Firebase 新 SDK,我正在尝试使用身份验证 SDK 创建一个新用户.但是,我完全按照文档说的做了,但它不起作用.有什么意见或建议吗?
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?
我在 RegisterUserViewController.h 中有身份验证代码
I have the code for Authentication in RegisterUserViewController.h
在 AppDelegate.h 中,我还在 application:didFinishLaunchingWithOptions; 中添加了 [FIRApp configure];
In AppDelegate.h I also added the [FIRApp configure] in application:didFinishLaunchingWithOptions;
这是 RegisterUserViewController.h 的代码:
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
这是我得到的错误:
Error Domain=FIRAuthErrorDomain Code=17999 发生内部错误,打印并检查错误详细信息以获取更多信息."UserInfo=0x7f98fc4609d0 {NSUnderlyingError=0x7f98fc4cf790操作无法完成.(FIRAuthInternalErrorDomain 错误 3.)", error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=发生内部错误,打印并检查错误详情以获取更多信息.>
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.}
推荐答案
我遇到了同样的错误,并通过在 Google 控制台上激活 Identity Toolkit Api 解决了它https://console.developers.google.com/apis/api/identitytoolkit/overview?project=YOUR_PROJECT
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屋!