コード例 #1
0
ファイル: Provider.php プロジェクト: socialconnect/auth
 /**
  * {@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]);
 }
コード例 #2
0
ファイル: Provider.php プロジェクト: venturamatthieu/todo
 /**
  * {@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);
 }
コード例 #3
0
ファイル: Provider.php プロジェクト: socialconnect/auth
 /**
  * {@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);
 }
コード例 #4
0
ファイル: Provider.php プロジェクト: socialconnect/auth
 /**
  * {@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);
 }
コード例 #5
0
ファイル: Provider.php プロジェクト: socialconnect/auth
 /**
  * {@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;
 }
コード例 #6
0
ファイル: Client.php プロジェクト: socialconnect/instagram
 /**
  * @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;
 }
コード例 #7
0
ファイル: Provider.php プロジェクト: socialconnect/auth
 /**
  * {@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);
 }