You are here

protected function AuthController::buildAuthorizeUrl in Auth0 Single Sign On 8.2

Same name and namespace in other branches
  1. 8 src/Controller/AuthController.php \Drupal\auth0\Controller\AuthController::buildAuthorizeUrl()

Build the Authorize url.

Parameters

null|string $prompt: If prompt=none should be passed, false if not.

string $returnTo: Local path|null if null, use default of /user.

Return value

string The URL to redirect to for authorization.

2 calls to AuthController::buildAuthorizeUrl()
AuthController::checkForError in src/Controller/AuthController.php
Check for errors.
AuthController::login in src/Controller/AuthController.php
Handles the login page override.

File

src/Controller/AuthController.php, line 349
Contains \Drupal\auth0\Controller\AuthController.

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

protected function buildAuthorizeUrl($prompt, $returnTo = NULL) {
  global $base_root;
  $auth0Api = new Authentication($this->helper
    ->getAuthDomain(), $this->clientId);
  $response_type = 'code';
  $redirect_uri = "{$base_root}/auth0/callback";
  $connection = NULL;
  $state = $this
    ->getNonce($returnTo);
  $additional_params = [];
  $additional_params['scope'] = AUTH0_DEFAULT_SCOPES;
  if ($this->offlineAccess) {
    $additional_params['scope'] .= ' offline_access';
  }
  if ($prompt) {
    $additional_params['prompt'] = $prompt;
  }
  return $auth0Api
    ->get_authorize_link($response_type, $redirect_uri, $connection, $state, $additional_params);
}