Facebook Oauth Page Pop Up is not closing after Clicking On Submit Button
allabouttech0803 opened this issue · 1 comments
allabouttech0803 commented
Hi All,
I am facing issue when I enter the FB credentials on the Pop UP Page, Can you please look into this
Steps to Reproduce
- Open the localhost URL
- Click on the Button to trigger the Login Authentication
But When I move all code inside of loginWithFacebook
to ngOnInit
It successfully authenticates and validates the User Properly and Pop Up Dialogue closes.
Can someone help me
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-secondary my-2 my-sm-0" type="submit" (click)="loginWithFacebook()">Login</button>
</form>
import { Component, OnInit } from '@angular/core';
import { FacebookService, LoginResponse, InitParams } from 'ngx-facebook';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
constructor(private fb: FacebookService) {
}
ngOnInit() {
}
loginWithFacebook(): void {
const initParams: InitParams = {
appId: '',
xfbml: true,
version: 'v2.11'
};
this.fb.init(initParams);
this.fb.login()
.then((response: LoginResponse) => console.log(response))
.catch((error: any) => console.error(error));
}
}
allabouttech0803 commented
After Changing to html below it worked hence closing the issue
<form class="form-inline my-2 my-lg-0">
<button class="btn btn-secondary my-2 my-sm-0" type="button" (click)="loginWithFacebook()">Login</button>
</form>