Ali
Ali

Reputation: 267077

Dynamically updating page if user connects/disconnects from Facebook?

Is there a way to dynamically update a page when the user connects/disconnects the app from his facebook?

I.e using one of the event subscriber methods that come with the javascript SDK?

I'm trying authResponseChange however my callback function doesn't seem to get called if I delete the app from my facebook account.

Upvotes: 1

Views: 105

Answers (2)

Nitzan Tomer
Nitzan Tomer

Reputation: 164139

Try to also register to the auth.statusChange event, though from my experience neither are really reliable.

You can know on the server side when a user deauthorizes your app, in the app settings > Advanced tab there's the field Deauthorize Callback where you can put a url in your server which will be pinged when a user removes the app.

With that you can then synchronize your client somehow.

Upvotes: 2

Paul Bruno
Paul Bruno

Reputation: 1906

You can manually check if a user is logged in, but hasn't authorized your app, using FB.getLoginStatus, passing a callback function in (see here in the Facebook JS SDK docs). Could you use the already existing events, and then perform checks of this kind each time? Maybe subscribe to the auth.authResponseChange and auth.statusChange events, and then call FB.getLoginStatus to see if it's changed.

Upvotes: 1

Related Questions