/** * {@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); }
/** * {@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]); }
/** * {@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); }
/** * {@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); }
/** * {@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); }
public function testConstructSuccess() { $token = new AccessToken('accessToken'); $this->assertSame('accessToken', $token->getToken()); return $token; }