Andrew Willis
Andrew Willis

Reputation: 2349

Facebook: removing users from a database who have unauthorized the application

I have a website which uses Facebook's registration plugin.

Everything is working fine, I have one issue though: if somebody was on Facebook and unauthorized my application then never returned to my site, how would I know?

The reason I am asking is I am storing user data in a database, namely the access_token, Facebook ID and (custom field) username, along with their joined date and last_active date.

Is there any way that Facebook can interact with my site when a user has unauthorized my app, allowing me to remove them from my site database?

Even something simple like:

$unauth_url = 'http://example.com/unauthorize';
file_get_contents($unauth_url . '?signed_request=' . $signed_facebook_request);

which runs when the page is app is removed would get the job done.

Is there anything like this available?

Upvotes: 0

Views: 555

Answers (2)

Broncko
Broncko

Reputation: 193

In your configuration of your facebook-app there is an option called deauth-request(or similar to that). There you can define a callback url, which will be invoked if somebody unauthorizes your app. Facebook passes soem POST information with that request to recognize the user for example.

You just have to implement a script on your server which deletes the user with that accesstoken from your database.

Upvotes: 0

Sujit Agarwal
Sujit Agarwal

Reputation: 12508

There is an interesting option in the fb platform called Deauthorize Callback ... It simple calls a page on your app or site when a user removes your app. Simple put the database record deletion code in this page...

Upvotes: 3

Related Questions