You are here

function oauth2_login in OAuth2 Login 8

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

Login with OAuth2.

2 calls to 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.
6 string references to 'oauth2_login'
MiniorangeConfigOAuthClient::buildForm in src/Form/MiniorangeConfigOAuthClient.php
Form constructor.
miniorange_oauth_clientController::miniorange_oauth_client_feedback_func in src/Controller/miniorange_oauth_clientController.php
miniorange_oauth_clientController::miniorange_oauth_client_mo_login in src/Controller/miniorange_oauth_clientController.php
OAuth2LoginTestCase::setUp in tests/oauth2_login.test
oauth2_loginController::oauth2_login_feedback_func in src/Controller/oauth2_loginController.php

... See full list

File

./oauth2_login.api.php, line 10
The programing interface provided by the module oauth2_login.

Code

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