yii\authclient\AuthAction::authSuccess PHP Method

authSuccess() protected method

This method is invoked in case of successful authentication via auth client.
protected authSuccess ( yii\authclient\ClientInterface $client ) : Response
$client yii\authclient\ClientInterface auth client instance.
return yii\web\Response response instance.
    protected function authSuccess($client)
    {
        if (!is_callable($this->successCallback)) {
            throw new InvalidConfigException('"' . get_class($this) . '::successCallback" should be a valid callback.');
        }
        $response = call_user_func($this->successCallback, $client);
        if ($response instanceof Response) {
            return $response;
        }
        return $this->redirectSuccess();
    }

Usage Example

 /** @inheritdoc */
 protected function authSuccess($client)
 {
     if (!is_callable($this->successCallback)) {
         $this->successCallback = [$this, 'onAuthSuccess'];
         parent::authSuccess($client);
     } else {
         /** @var OAuth2 $client */
         $this->onAuthSuccess($client);
         parent::authSuccess($client);
     }
 }
All Usage Examples Of yii\authclient\AuthAction::authSuccess