You are here

function oauth2_login in OAuth2 Login 7.2

Same name in this branch
  1. 7.2 oauth2_login.module \oauth2_login()
  2. 7.2 oauth2_login.api.php \oauth2_login()
Same name and namespace in other branches
  1. 8 oauth2_login.api.php \oauth2_login()
  2. 7 oauth2_login.module \oauth2_login()
  3. 7 oauth2_login.api.php \oauth2_login()

Login with OAuth2.

3 calls to oauth2_login()
oauth2_login_callback in ./oauth2_login.module
Callback function for the menu user/oauth2_login.
oauth2_user_authenticate in oauth2_user/oauth2_user.api.php
Authenticate the user (redirect to login). But first save the given form_state in session.
oauth2_user_authenticate in oauth2_user/authenticate.inc
Authenticate the user (redirect to login). But first save the given form_state in session.
3 string references to 'oauth2_login'
OAuth2LoginTestCase::setUp in tests/oauth2_login.test
Sets up a Drupal site for running functional and integration tests.
oauth2_login_disable in ./oauth2_login.install
Implements hook_disable().
oauth2_login_enable in ./oauth2_login.install
Implements hook_enable().

File

./oauth2_login.module, line 186
Provides OAuth2 Login functionality.

Code

function oauth2_login($destination = NULL, $destination_error = NULL) {
  $enabled = variable_get('oauth2_login_enabled', FALSE);
  if (!$enabled) {
    drupal_goto('user/login', [
      'query' => drupal_get_destination(),
    ]);
    return;
  }
  if ($destination === NULL) {
    $destination = drupal_get_destination();
    $destination = $destination['destination'];
  }
  if ($destination_error === NULL) {
    $destination_error = 'user/login';
  }
  $query = [
    'destination' => $destination,
    'destination_error' => $destination_error,
  ] + $_GET;
  unset($query['q']);
  drupal_goto('hybridauth/window/DrupalOAuth2', [
    'query' => $query,
  ]);
}