public function OauthController::authFinish in Media: Acquia DAM 8
Finish the authentication process.
Route: /acquiadam/authFinish.
1 string reference to 'OauthController::authFinish'
File
- src/
Controller/ OauthController.php, line 193
Class
- OauthController
- Controller routines for acquiadam routes.
Namespace
Drupal\media_acquiadam\ControllerCode
public function authFinish() {
$authFinishRedirect = $this->request->query
->get('auth_finish_redirect');
if ($original_path = $this->request->query
->get('original_path', FALSE)) {
$authFinishRedirect .= '&original_path=' . $original_path;
}
$this->oauth
->setAuthFinishRedirect($authFinishRedirect);
if (!$this->oauth
->authRequestStateIsValid($this->request
->get('state'))) {
throw new AccessDeniedHttpException();
}
$access_token = $this->oauth
->getAccessToken($this->request
->get('code'));
$this->userData
->set('media_acquiadam', $this->currentUser
->id(), 'acquiadam_access_token', $access_token['access_token']);
$this->userData
->set('media_acquiadam', $this->currentUser
->id(), 'acquiadam_access_token_expiration', $access_token['expire_time']);
$this->userData
->set('media_acquiadam', $this->currentUser
->id(), 'acquiadam_refresh_token', $access_token['refresh_token']);
return new RedirectResponse($authFinishRedirect);
}