protected function OAuth2Client::getAuthenticationUrl in OAuth2 Client 8
Return the authentication url (used in case of the server-side flow).
1 call to OAuth2Client::getAuthenticationUrl()
- OAuth2Client::getTokenServerSide in src/
Service/ OAuth2Client.php - Get an access_token using the server-side (authorization code) flow.
File
- src/
Service/ OAuth2Client.php, line 425
Class
- OAuth2Client
- OAuth2Client service.
Namespace
Drupal\oauth2_client\ServiceCode
protected function getAuthenticationUrl() {
$state = md5(uniqid(rand(), TRUE));
$query_params = [
'response_type' => 'code',
'client_id' => $this->params['client_id'],
'redirect_uri' => $this->params['redirect_uri'],
'state' => $state,
];
if ($this->params['scope']) {
$query_params['scope'] = $this->params['scope'];
}
$endpoint = $this->params['authorization_endpoint'];
self::setRedirect($state);
return $endpoint . '?' . http_build_query($query_params);
}