Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $response = $this->service->getHttpClient()->request($this->getBaseUri() . 'method/users.get', ['v' => '5.24', 'access_token' => $accessToken->getToken()]);
     $body = $response->getBody();
     $result = json_decode($body);
     $hydrator = new ObjectMap(array('id' => 'id', 'first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email'));
     return $hydrator->hydrate(new User(), $result->response[0]);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $response = $this->service->getHttpClient()->request($this->getBaseUri() . 'me', ['access_token' => $accessToken->getToken()]);
     $body = $response->getBody();
     $result = json_decode($body);
     $hydrator = new ObjectMap(array('id' => 'id', 'first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email', 'gender' => 'sex', 'link' => 'url', 'locale' => 'locale', 'name' => 'username', 'timezone' => 'timezone', 'updated_time' => 'dateModified', 'verified' => 'verified'));
     return $hydrator->hydrate(new User(), $result);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $response = $this->service->getHttpClient()->request($this->getBaseUri() . 'user', ['access_token' => $accessToken->getToken()]);
     $body = $response->getBody();
     $result = json_decode($body);
     $hydrator = new ObjectMap(array('id' => 'id', 'url' => 'api_url', 'html_url' => 'url', 'followers_url' => 'followers_url', 'following_url' => 'following_url', 'gists_url' => 'gists_url', 'starred_url' => 'starred_url', 'subscriptions_url' => 'subscriptions_url', 'organizations_url' => 'organizations_url', 'repos_url' => 'repos_url', 'events_url' => 'events_url', 'received_events_url' => 'received_events_url', 'type' => 'type', 'site_admin' => 'site_admin', 'name' => 'name', 'company' => 'company', 'blog' => 'blog', 'location' => 'location', 'login' => 'login', 'avatar_url' => 'avatar_url', 'gravatar_id' => 'gravatar_id', 'hireable' => 'hireable', 'bio' => 'bio', 'public_repos' => 'public_repos', 'public_gists' => 'public_gists', 'followers' => 'followers', 'following' => 'following', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'email' => 'email'));
     return $hydrator->hydrate(new User(), $result);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $response = $this->service->getHttpClient()->request($this->getBaseUri() . 'users/self', ['access_token' => $accessToken->getToken()]);
     $body = $response->getBody();
     $result = json_decode($body);
     $hydrator = new ObjectMap(array('id' => 'id', 'username' => 'username', 'bio' => 'bio', 'website' => 'website', 'profile_picture' => 'profile_picture', 'full_name' => 'full_name'));
     return $hydrator->hydrate(new User(), $result->data);
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $this->consumerToken = $accessToken;
     $parameters = $this->requestTokenParams;
     $parameters['user_id'] = $accessToken->getUserId();
     $response = $this->oauthRequest($this->getBaseUri() . 'users/lookup.json', Client::GET, $parameters, $this->requestTokenHeaders);
     if ($response->getStatusCode() == 200) {
         $result = $response->json();
         $hydrator = new ObjectMap(array());
         return $hydrator->hydrate(new User(), $result[0]);
     }
     return false;
 }
Exemplo n.º 6
0
 /**
  * @param string $id
  * @return bool|mixed
  * @throws \Exception
  */
 public function getUser($id = 'self')
 {
     $this->assertId($id);
     $result = $this->request('users/' . $id);
     if ($result) {
         $hydrator = new Hydrator\ObjectMap(array());
         return $hydrator->hydrate(new Entity\User(), $result);
     }
     return false;
 }
Exemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function getIdentity(AccessToken $accessToken)
 {
     $response = $this->service->getHttpClient()->request($this->getBaseUri() . 'oauth2/v1/userinfo', ['access_token' => $accessToken->getToken()]);
     $body = $response->getBody();
     $result = json_decode($body);
     $hydrator = new ObjectMap(array('id' => 'id', 'given_name' => 'firstname', 'family_name' => 'lastname', 'email' => 'email'));
     return $hydrator->hydrate(new User(), $result);
 }