I have been having some problems with firebase authentication and am looking for some help.
Basically, for my google+ login, I am able to open up an inapp browser and select the profile I wish to login into. However, it seems like the authentication stops there as I am led back to my original page. I have used *ngIf to change the layout of the login page when I return but the changes are not shown. Anyone have any idea?
my code for the html is as below:
<button block ion-button (click)="login('facebook')" *ngIf = "!provider.loggedin" item-left><ion-icon name="logo-facebook"></ion-icon> Login With Facebook</button>
<button block ion-button (click)="login('google')" *ngIf = "!provider.loggedin" item-left><ion-icon name="logo-googleplus"></ion-icon> Login With Google</button>
<ion-card *ngIf = "provider.loggedin">
<img src="{{ provider.profilePicture }}"/>
<ion-card-content>
<ion-card-title>
{{ provider.name }}
</ion-card-title>
<p style = "text-align: center">
{{ provider.email }}
</p>
</ion-card-content>
</ion-card>
<button block ion-button (click)="FinalLogin()" *ngIf = "provider.loggedin" item-left>Please Enter!!</button>
<button block ion-button (click)="logout()" *ngIf = "provider.loggedin" item-left>Logout</button>
The code for the home.ts is as follows:
login(provider){
let signInProvider = null;
console.log("Help")
switch(provider){
case "facebook":
signInProvider = new firebase.auth.FacebookAuthProvider()
console.log("Help2")
break;
case "google":
signInProvider = new firebase.auth.GoogleAuthProvider()
console.log("helping me")
break;
}
console.log("help3")
this.fire.auth.signInWithRedirect(signInProvider)
.then ( () => {
console.log("Help4")
this.fire.auth.getRedirectResult().then( res => {
console.log(res)
console.log('from -Google--')
this.provider.loggedin = true;
this.provider.name = res.user.displayName;
this.provider.name = res.user.email;
this.provider.profilePicture = res.user.photoURL;
this.ref.detectChanges();
console.log(res)
this.navCtrl.push(LoggedinPage);
});
})
}