Beispiel #1
0
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $response = $this->getHttpClient()->get($this->baseUrl . '/oauth2.0/me?access_token=' . $token->getToken());
     $this->openId = json_decode($this->removeCallback($response->getBody()->getContents()), true)['openid'];
     $queries = ['access_token' => $token->getToken(), 'openid' => $this->openId, 'oauth_consumer_key' => $this->clientId];
     $response = $this->getHttpClient()->get($this->baseUrl . '/user/get_user_info?' . http_build_query($queries));
     return json_decode($this->removeCallback($response->getBody()->getContents()), true);
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $userUrl = 'https://api.github.com/user?access_token=' . $token->getToken();
     $response = $this->getHttpClient()->get($userUrl, $this->getRequestOptions());
     $user = json_decode($response->getBody(), true);
     if (in_array('user:email', $this->scopes)) {
         $user['email'] = $this->getEmailByToken($token);
     }
     return $user;
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $appSecretProof = hash_hmac('sha256', $token->getToken(), $this->clientSecret);
     $response = $this->getHttpClient()->get($this->graphUrl . '/' . $this->version . '/me?access_token=' . $token . '&appsecret_proof=' . $appSecretProof . '&fields=' . implode(',', $this->fields), ['headers' => ['Accept' => 'application/json']]);
     return json_decode($response->getBody(), true);
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $response = $this->getHttpClient()->get($this->baseUrl . '/' . $this->version . '/users/show.json', ['query' => ['uid' => $token['uid'], 'access_token' => $token->getToken()], 'headers' => ['Accept' => 'application/json']]);
     return json_decode($response->getBody(), true);
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $response = $this->getHttpClient()->get($this->baseUrl . '/userinfo', ['query' => ['access_token' => $token->getToken(), 'openid' => $token['openid'], 'lang' => 'zh_CN']]);
     return json_decode($response->getBody(), true);
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $response = $this->getHttpClient()->get('https://api.douban.com/v2/user/~me', ['headers' => ['Authorization' => 'Bearer ' . $token->getToken()]]);
     return json_decode($response->getBody()->getContents(), true);
 }
 /**
  * @param \Notadd\Auth\Social\Contracts\AccessToken $token
  * @return mixed
  */
 protected function getUserByToken(AccessTokenContract $token)
 {
     $response = $this->getHttpClient()->get('https://www.googleapis.com/plus/v1/people/me?', ['query' => ['prettyPrint' => 'false'], 'headers' => ['Accept' => 'application/json', 'Authorization' => 'Bearer ' . $token->getToken()]]);
     return json_decode($response->getBody(), true);
 }