public static function OAuth2Client::setRedirect in OAuth2 Client 8
Save the information needed for redirection after getting the token.
Overrides OAuth2ClientInterface::setRedirect
2 calls to OAuth2Client::setRedirect()
- OAuth2Client::getAuthenticationUrl in src/
Service/ OAuth2Client.php - Return the authentication url (used in case of the server-side flow).
- oauth2_client_set_redirect in ./
oauth2_client.module - Set a redirect request.
File
- src/
Service/ OAuth2Client.php, line 248
Class
- OAuth2Client
- OAuth2Client service.
Namespace
Drupal\oauth2_client\ServiceCode
public static function setRedirect($state, $redirect = NULL) {
if ($redirect == NULL) {
$redirect = [
'uri' => \Drupal::request()
->getRequestUri(),
'client' => 'oauth2_client',
];
}
if (!isset($redirect['client'])) {
$redirect['client'] = 'external';
}
/** @var \Drupal\Core\TempStore\PrivateTempStore $tempstore */
$tempstore = \Drupal::service('tempstore.private')
->get('oauth2_client');
$redirects = $tempstore
->get('redirect');
$redirects[$state] = $redirect;
$tempstore
->set('redirect', $redirects);
}