我使用angular5-social-login进行身份验证。 我创建了一个按钮,该按钮可打开Facebook登录对话框,并且在单击打开的窗口的“ x”关闭对话框时需要捕获一个事件。 我通过捕获错误响应进行了尝试,但是没有成功。 如何访问取消事件?
这是我的职责。
public openModal(): void {
if (!this.modalIsOpen) {
const socialPlatformProvider = FacebookLoginProvider.PROVIDER_ID;
this.modalIsOpen = true;
this.socialAuthService.signIn(socialPlatformProvider).then(
(userData) => {
const token: string = userData.token;
const userName: string = userData.name;
this.fbService.fbAdAccounts(userId, token).subscribe(res => {
const requestBody: any= {
fb_access_token: token,
name: userName
};
this.fbService.getFbLongAccessToken(<any>{
grant_type: 'fb_exchange_token',
client_id: FbOauthConstants.FB_LOGIN_PROVIDED_ID,
client_secret: FbOauthConstants.FB_LOGIN_PROVIDED_SECRET_ID,
fb_exchange_token: token
}).subscribe(tokenResult => {
this.checkBoxes = res.data;
this.dialogService.addDialog(AdAccountConfirmationComponent, {
checkBoxes: this.checkBoxes,
requestBody: requestBody,
fb_unlimited_access_token: tokenResult.access_token
}).subscribe((selectedData: any) => {
this.modalIsOpen = false;
if (selectedData) {
const requestData: any[] = [];
selectedData.forEach((item) => {
const currentAccount: any= <any>{};
currentAccount.fb_access_token = tokenResult.access_token;
currentAccount.fb_user_name = item.name;
currentAccount.name = requestBody.name;
});
}
});
});
});
})
.catch((err) => console.log(err));
}
}