You are here

function fboauth_deauthorize in Facebook OAuth (FBOAuth) 7

Same name and namespace in other branches
  1. 6 includes/fboauth.fboauth.inc \fboauth_deauthorize()
  2. 7.2 includes/fboauth.fboauth.inc \fboauth_deauthorize()

Process a deauthorization request from Facebook.

See also

https://developers.facebook.com/docs/authentication/signed_request/

1 string reference to 'fboauth_deauthorize'
fboauth_menu in ./fboauth.module
Implements hook_menu().

File

includes/fboauth.fboauth.inc, line 909
Provides functions used during Facebook login processes.

Code

function fboauth_deauthorize() {

  // A signed_request key is used when a deauth url is provided by the app.
  if (isset($_POST['signed_request'])) {
    $app_secret = variable_get('fboauth_secret', '');
    $signed_request = fboauth_parse_signed_request($_POST['signed_request'], $app_secret);
    if ($signed_request && ($deauth_uid = fboauth_uid_load($signed_request['user_id']))) {
      fboauth_save($deauth_uid, NULL);
      watchdog('fboauth', 'The account for UID @uid has been disconnected from Facebook by the user via Facebook.', array(
        '@uid' => $deauth_uid,
      ));

      // Allow other modules to hook into a deauth event.
      module_invoke_all('fboauth_deauthorize', $deauth_uid, $signed_request['user_id']);
    }
  }
}