public function get_user_info(Token_Access $token) { $request = Request::make('resource', 'GET', 'https://identity.x.com/xidentity/resources/profile/me', array('oauth_token' => $token->access_token)); $response = json_decode($request->execute()); $user = $response->identity; return array('uid' => $user->userId, 'nickname' => \Str::slug($user->fullName, '-'), 'name' => $user->fullName, 'first_name' => $user->firstName, 'last_name' => $user->lastName, 'email' => $user->emails[0], 'location' => isset($user->addresses) ? $user->addresses[0] : '', 'image' => null, 'description' => null, 'urls' => array('paypal' => null)); }
public function get_user_info(Token_Access $token) { $request = Request::make('resource', 'GET', 'https://graph.facebook.com/me', array('access_token' => $token->access_token)); $user = json_decode($request->execute()); // Create a response from the request return array('uid' => $user->id, 'name' => $user->name, 'nickname' => isset($user->username) ? $user->username : null, 'email' => isset($user->email) ? $user->email : null, 'image' => 'https://graph.facebook.com/me/picture?type=normal&access_token=' . $token->access_token, 'urls' => array('facebook' => $user->link)); }
public function get_user_info(Token_Access $token) { $request = Request::make('resource', 'GET', 'https://api.soundcloud.com/me.json', array('oauth_token' => $token->access_token)); $user = json_decode($request->execute()); // Create a response from the request return array('uid' => $user->id, 'nickname' => $user->username, 'name' => $user->full_name, 'location' => $user->country . ' ,' . $user->country, 'description' => $user->description, 'image' => $user->avatar_url, 'urls' => array('myspace' => $user->myspace_name, 'website' => $user->website)); }
public function get_user_info(Token_Access $token) { $url = 'https://api.github.com/user?' . http_build_query(array('access_token' => $token->access_token)); $request = Request::make('resource', 'GET', 'https://api.github.com/user', array('access_token' => $token->access_token)); $user = json_decode($request->execute()); // Create a response from the request return array('uid' => $user->id, 'nickname' => $user->login, 'name' => isset($user->name) ? $user->name : null, 'email' => isset($user->email) ? $user->email : null, 'urls' => array('github' => 'http://github.com/' . $user->login, 'blog' => isset($user->blog) ? $user->blog : null)); }
public function get_user_info(Token_Access $token) { $request = Request::make('resource', 'GET', 'https://api.foursquare.com/v2/users/self', array('oauth_token' => $token->access_token)); $response = json_decode($request->execute()); $user = $response->response->user; // Create a response from the request return array('uid' => $user->id, 'name' => sprintf('%s %s', $user->firstName, $user->lastName), 'email' => $user->contact->email, 'image' => $user->photo, 'location' => $user->homeCity); }
public function get_user_info(Token_Access $token) { // define the get user information token $request = Request::make('resource', 'GET', 'https://apis.live.net/v5.0/me', array('access_token' => $token->access_token)); // perform network request $user = json_decode($request->execute()); // create a response from the request and return it return array('uid' => $user->id, 'name' => $user->name, 'email' => isset($user->emails->preferred) ? $user->emails->preferred : null, 'nickname' => \Str::slug($user->name, '-'), 'locale' => $user->locale, 'urls' => array('windowslive' => $user->link)); }
public function access($code, $options = array()) { $params = array('client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => array_get($options, 'grant_type', 'authorization_code'), 'type' => 'web_server'); switch ($params['grant_type']) { case 'authorization_code': $params['code'] = $code; $params['redirect_uri'] = array_get($options, 'redirect_uri', $this->redirect_uri); break; case 'refresh_token': $params['refresh_token'] = $code; break; } $response = null; $url = $this->url_access_token(); $request = Request::make('access', $this->method, $url, $params); $response = $request->execute(); if (isset($response->error)) { throw new Exception($response); } return Token::make('access', $response->params); }
public function get_user_info(Token_Access $token) { $request = Request::make('resource', 'GET', 'https://www.googleapis.com/oauth2/v1/userinfo', array('access_token' => $token->access_token)); $user = json_decode($request->execute(), true); return array('uid' => $user['email'], 'nickname' => \Str::slug($user['name'], '-'), 'name' => $user['name'], 'email' => $user['email'], 'location' => null, 'image' => isset($user['picture']) ? $user['picture'] : '', 'description' => null, 'urls' => array('googleplus' => isset($user['link']) ? $user['link'] : '')); }