You are here

public function UserAuthenticator::dispatchAuthenticationError in Social Auth 8.2

Same name and namespace in other branches
  1. 3.x src/User/UserAuthenticator.php \Drupal\social_auth\User\UserAuthenticator::dispatchAuthenticationError()

Dispatch an event when authentication in provider fails.

Parameters

string|null $error: The error string/code from provider.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Return redirect response.

File

src/User/UserAuthenticator.php, line 421

Class

UserAuthenticator
Manages Drupal authentication tasks for Social Auth.

Namespace

Drupal\social_auth\User

Code

public function dispatchAuthenticationError($error = NULL) {
  $event = new FailedAuthenticationEvent($this->dataHandler, $this
    ->getPluginId(), $error ?? NULL);
  $this->eventDispatcher
    ->dispatch(SocialAuthEvents::FAILED_AUTH, $event);
  if ($event
    ->hasResponse()) {
    return $event
      ->getResponse();
  }
  return NULL;
}