本文整理汇总了PHP中yii\authclient\ClientInterface::getAccessToken方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::getAccessToken方法的具体用法?PHP ClientInterface::getAccessToken怎么用?PHP ClientInterface::getAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\authclient\ClientInterface
的用法示例。
在下文中一共展示了ClientInterface::getAccessToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pushSocialLink
/**
* @param \yii\authclient\ClientInterface $Client
* @return bool
* @throws \yii\web\ServerErrorHttpException
*/
public function pushSocialLink(\yii\authclient\ClientInterface $Client)
{
/** @var \cookyii\modules\Account\resources\Account\Model $self */
$self = $this;
$attributes = $Client->getUserAttributes();
/** @var $Model AccountAuthModel */
$Model = \Yii::createObject(AccountAuthModel::class);
$token = null;
if ($Client instanceof \yii\authclient\BaseOAuth) {
$Token = $Client->getAccessToken();
$token = ArrayHelper::toArray($Token);
$token['params'] = $Token->getParams();
}
return $Model::push($self->id, $Client->getId(), $attributes['id'], $token);
}
示例2: parseProvider
/**
* Parse provider
*
* @return array
*/
private function parseProvider()
{
$profile = $this->client->getUserAttributes();
$token = $this->client->getAccessToken()->getParams();
$data = [];
switch ($this->type) {
case UserProvider::TYPE_FACEBOOK:
$data = $this->parseProviderFacebook($profile, $token);
break;
case UserProvider::TYPE_VKONTAKTE:
$data = $this->parseProviderVkontakte($profile, $token);
break;
case UserProvider::TYPE_TWITTER:
$data = $this->parseProviderTwitter($profile, $token);
break;
}
$data['type'] = $this->type;
return $data;
}