コード例 #1
0
ファイル: UserContacts.php プロジェクト: vishnu-b/invite
 /**
  * Gets all the google contacts of authenticated user
  * @param  Request $request
  * @return mixed
  */
 public function get($request)
 {
     $googleService = $this->oAuth->consumer('Google');
     $code = $request->code;
     if (!is_null($code)) {
         $token = $googleService->requestAccessToken($code);
         $result = json_decode($googleService->request("https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=400"), true);
         $contacts = [];
         foreach ($result['feed']['entry'] as $contact) {
             if (isset($contact['gd$email'])) {
                 $contacts[] = ['email' => $contact['gd$email'][0]['address'], 'title' => $contact['title']['$t']];
             }
         }
         $contacts = $this->categorize($contacts);
         \Session::set('contacts', $contacts);
         return redirect()->route('contacts');
     } else {
         $url = $googleService->getAuthorizationUri();
         return redirect((string) $url);
     }
 }
コード例 #2
0
ファイル: _ide_helper.php プロジェクト: xiao-hu00/phphub
 /**
  * 
  *
  * @param string $service
  * @param string $url
  * @param array $scope
  * @return \OAuth\Common\Service\AbstractService 
  * @static 
  */
 public static function consumer($service, $url = null, $scope = null)
 {
     return \Artdarek\OAuth\OAuth::consumer($service, $url, $scope);
 }
コード例 #3
0
ファイル: LoginController.php プロジェクト: jigen7/laravel5
 /**
  * Create a new controller instance.
  */
 public function __construct(OAuth $oauth)
 {
     $oauth->setHttpClient('CurlClient');
     $this->oauth = $oauth;
 }