Facebook user deauthorizes the app

前端 未结 2 1477
小蘑菇
小蘑菇 2020-12-15 12:27

when user accepts the facebook application from my website, I am storing the user details and facebook details(access token) in database.

when he removes my applica

2条回答
  •  执念已碎
    2020-12-15 13:02

    It's clearly stated in the authentication document:

    App Deauthorization

    When a user of your app removes it in the App Dashboard or blocks the app in the News Feed, your app can be notified by specifying a Deauthorize Callback URL in the Developer App. During app removal we will send an HTTP POST request containing a single parameter, signed_request, which contains the user id (UID) of the user that just removed your app. You will not receive an user access token in this request and all existing user access tokens will be automatically expired.

    So using the signed_request function on its own docuement:

    
    

    So all you need to do is get the $result["user_id"] query your DB and remove the record.

    P.S: I would recommend adding a new field called active and just deactivate the user instead of removing the record all together.

    EDIT:
    Facebook will NOT redirect the user to the deauthorize URL! it'll ping it only:

    Facebook pings this URL when a user deauthorizes your app

提交回复
热议问题