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); }