/**
  * {@inheritdoc}.
  */
 protected function getUserByToken(AccessTokenInterface $token)
 {
     $response = $this->openPlatform->getAuthorizerBaseInfo($token->getAttribute('authorizer_appid'));
     $response->set('authorization_info', $token->toArray());
     return $response->all();
 }
Beispiel #2
0
 /**
  * {@inheritdoc}.
  */
 protected function getUserByToken(AccessTokenInterface $token)
 {
     $scopes = explode(',', $token->getAttribute('scope', ''));
     if (in_array('snsapi_base', $scopes)) {
         return $token->toArray();
     }
     if (empty($token['openid'])) {
         throw new InvalidArgumentException('openid of AccessToken is required.');
     }
     $response = $this->getHttpClient()->get($this->baseUrl . '/userinfo', ['query' => ['access_token' => $token->getToken(), 'openid' => $token['openid'], 'lang' => 'zh_CN']]);
     return json_decode($response->getBody(), true);
 }