I am using login via google and facebook and therefore I use firebase Ui authentication. I got it right but I don't want the "Sign In with Email" button in the login page. My login page is as,
My code is as below,
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%s","viewDidLoad");
authUI = [FUIAuth defaultAuthUI];
authUI.delegate = self;
NSArray<id<FUIAuthProvider>> *providers = @[[[FUIGoogleAuth alloc] init],[[FUIFacebookAuth alloc] init]];
authUI.providers = providers;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSLog(@"%s","viewDidAppear");
NSLog([self isUserSignedIn] ? @"YES":@"NO");
if([self isUserSignedIn] == false){
[self showLoginView];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(BOOL)isUserSignedIn{
NSLog(@"%s","isUserSignedIn");
FIRUser *currentUser = [[FIRAuth auth] currentUser];
NSLog(@"%@",currentUser);
if(currentUser == NULL){
return false;
}
else{
return true;
}
}
-(void)showLoginView{
NSLog(@"%s","showLoginView");
UINavigationController *controller = [authUI authViewController];
if(controller){
[self presentViewController:controller animated:YES completion:nil];
}
}
- (void)authUI:(FUIAuth *)authUI didSignInWithUser:(nullable FIRUser *)user error:(nullable NSError *)error {
if (error == nil) {
NSLog(@"%@",user.email);
NSLog(@"%@",user.displayName);
}
else{
NSLog(@"%@",error);
}
}
- (IBAction)signOut:(id)sender {
NSError *signOutError;
BOOL status = [[FIRAuth auth] signOut:&signOutError];
if (!status) {
NSLog(@"Error signing out: %@", signOutError);
return;
}
else{
NSLog(@"SignedOut");
}
}
In AppDelegate.m added,
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
NSLog(@"%@",url);
return [[FUIAuth defaultAuthUI] handleOpenURL:url sourceApplication:sourceApplication];
}
How do I remove "Sign in with email". I added only google and Facebook as providers, how come there is this additional button shown in the login page?
FUIAuth *authUI = [FUIAuth defaultAuthUI];
authUI.signInWithEmailHidden = YES;
Removed the "Sign in with email" button from the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With