You are here

function auth0_user_logout in Auth0 Single Sign On 7.2

Implements hook_user_logout().

Logs the user out of Auth0 if SSO is in use.

File

./auth0.module, line 858

Code

function auth0_user_logout($account) {

  // If Single Sign On is enabled then log the user out from Auth0.
  if (variable_get("auth0_sso", FALSE)) {
    session_destroy();
    $domain = check_plain(variable_get("auth0_domain", ''));
    if (variable_get("auth0_returnTo_app", FALSE)) {
      $client = check_plain(variable_get("auth0_client_id", ''));
      drupal_goto("https://{$domain}/v2/logout?returnTo=" . urlencode(url('<front>', array(
        'absolute' => TRUE,
      ))) . "&client_id={$client}");
    }
    else {
      drupal_goto("https://{$domain}/v2/logout?returnTo=" . urlencode(url('<front>', array(
        'absolute' => TRUE,
      ))));
    }
  }
}