ngx-facebook
ngx-facebook copied to clipboard
Logout not working
Hi, I have a issue with logout function. Init function:
let initParams: InitParams = {
appId: '000000000000',
xfbml: true,
status: true,
cookie: true,
version: 'v2.9'
};
this.fb.init(initParams);
Logout function:
this.fb.logout()
.then(response => {
console.log(response)
})
.catch((error: any) => {
console.error(error)
});
Thats looks like works but it is not.
The console show:
Object {authResponse: Object, status: "unknown"}
And it should be:
Object {authResponse: null, status: "unknown"}
Thats why if you refresh the page you continues logged.
you can try this
this.fb.getLoginStatus()
.then(res=>{
if(res && res.status == 'connected'){
this.fb.logout()
.then(res=>{console.log(res)})
.catch(this.handleError);
}
}).catch(this.handleError)
Hi, Thats is not working, I think the cookie is the problem but I need it. I believe that sdk works over facebook cookie so if you do not delete them you still logged but if you delete it, you get logged out from facebook. I want logout from my web but not from facebook.
Thanks for you answer.
@mtoribio I am having the same problem, when I call the fb.logout() function I am not logged out of Facebook nor my app. Is there a workaround for this? Or is a solution for this in sight?
Same here.
When refresing the page - it log out
Using cookie: true,
solves it, but then it's impossible to log out.
@zyra @ihadeed any idea?
Any fixes for this?
Edit: I also noticed that the getLoginStatus() isn't working
I have the same problem! Even I can't get the Object {authResponse: Object, status: "unknown"}
in the response of logout function.
Another case, can we have any solution to logout only from my application, this.fb.logout() logs me out complitly from facebook.com page! :(
The same... Can it be related to this stuff:
https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus#servers
let initParams: InitParams = {
appId: 'xxxxx',
xfbml: true,
version: 'v2.11',
cookie: true
};
this.fb.init(initParams);
my solution was to place a cookie: true
this.fb.getLoginStatus()
.then(res => {
if ( res && res.status === 'connected' ) {
this.fb.logout();
this.borrarLocal();
}
})
I had the same problem, try this one:
FB.api(
'/me/permissions',
'DELETE',
{},
function(response) {
// Here fb should remove the token.
// response should be "success: true"
FB.logout(() => {
// Here logout.
});
}
);
solved my problem, have a nice day :)