You are here

function hook_oauth2_server_pre_authorize in OAuth2 Server 7

Same name and namespace in other branches
  1. 8 oauth2_server.api.php \hook_oauth2_server_pre_authorize()
  2. 2.0.x oauth2_server.api.php \hook_oauth2_server_pre_authorize()

Execute operations before oauth2_server_authorize() main logic.

Allow modules to perform additional operations at the very beginning of the OAuth2 authorize callback.

1 invocation of hook_oauth2_server_pre_authorize()
oauth2_server_authorize_page in ./oauth2_server.pages.inc
Page callback: Authenticates the user and redirect back to the client with an authorization code.

File

./oauth2_server.api.php, line 14
Hooks provided by the OAuth2 Server module.

Code

function hook_oauth2_server_pre_authorize() {

  // Make sure we're not in the middle of a running operation.
  if (empty($_SESSION['oauth2_server_authorize'])) {
    global $user;

    // Ensure that the current session is killed before authorize.
    module_invoke_all('user_logout', $user);

    // Destroy the current session, and reset $user to the anonymous user.
    session_destroy();
  }
}