_service = $service; } public function actions() { return [ 'auth' => [ 'class' => AuthAction::class, 'successCallback' => [$this, 'onAuthSuccess'], ], ]; } public function onAuthSuccess(ClientInterface $client): void { $network = $client->getId(); $attributes = $client->getUserAttributes(); $identity = ArrayHelper::getValue($attributes, 'id'); try { $user = $this->_service->auth($network, $identity); Yii::$app->user->login(new Identity($user), Yii::$app->params['user.rememberMeDuration']); } catch (\DomainException $e) { Yii::$app->errorHandler->logException($e); Yii::$app->session->setFlash('error', $e->getMessage()); } } }