This method is invoked in case of successful authentication via auth client.
protected authSuccess ( yii\authclient\ClientInterface $client ) : |
||
$client | yii\authclient\ClientInterface | auth client instance. |
return | response instance. |
/** @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); } }
protected function authSuccess($client) { /** @var \yii\authclient\BaseClient $client */ $this->socialServiceId = SocialService::classNameToId($client->className()); if ($this->socialServiceId === 0) { throw new ServerErrorHttpException("SocialService unknown"); } // first find user service on this id $userAttributes = $client->getUserAttributes(); $this->serviceId = $userAttributes['id']; //! @todo Add caching here based on commonTag $this->userService = UserService::find()->where(['service_id' => $this->serviceId, 'social_service_id' => $this->socialServiceId])->one(); return parent::authSuccess($client); }
/** * @inheritdoc */ public function authSuccess($client) { return parent::authSuccess($client); }