当前位置: 首页>>代码示例>>PHP>>正文


PHP Google_Client::setClientID方法代码示例

本文整理汇总了PHP中Google_Client::setClientID方法的典型用法代码示例。如果您正苦于以下问题:PHP Google_Client::setClientID方法的具体用法?PHP Google_Client::setClientID怎么用?PHP Google_Client::setClientID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Google_Client的用法示例。


在下文中一共展示了Google_Client::setClientID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     parent::init();
     // api dependencies
     $client = new Google_Client();
     $client->setClassConfig('Google_Cache_File', 'directory', realpath(dirname(__FILE__) . '/../../giga_cache'));
     $client->setApplicationName($this->app_name);
     $client->setScopes(Google_Service_Analytics::ANALYTICS);
     $client->setAssertionCredentials(new Google_Auth_AssertionCredentials($this->client_email, array(Google_Service_Analytics::ANALYTICS), file_get_contents($this->keyfile)));
     $client->setClientID($this->client_id);
     $this->client = $client;
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:12,代码来源:Analytics.php

示例2: googleoauth

 public function googleoauth()
 {
     $file = File::get(__DIR__ . "/../../.google");
     $file_arr = json_decode($file, true);
     $practice = DB::table('practiceinfo')->where('practice_id', '=', Session::get('practice_id'))->first();
     $client_id = $file_arr['web']['client_id'];
     $client_secret = $file_arr['web']['client_secret'];
     $url = Request::URL();
     $google = new Google_Client();
     $google->setRedirectUri($url);
     $google->setApplicationName('NOSH ChartingSystem');
     $google->setClientID($client_id);
     $google->setClientSecret($client_secret);
     $google->setAccessType('offline');
     $google->setApprovalPrompt('force');
     $google->setScopes(array('https://mail.google.com/'));
     if (isset($_REQUEST["code"])) {
         $credentials = $google->authenticate($_GET['code']);
         $result = json_decode($credentials, true);
         $data['google_refresh_token'] = $result['refresh_token'];
         DB::table('practiceinfo')->where('practice_id', '=', Session::get('practice_id'))->update($data);
         return Redirect::intended('/');
     } else {
         $authUrl = $google->createAuthUrl();
         header('Location: ' . filter_var($authUrl, FILTER_SANITIZE_URL));
         exit;
     }
 }
开发者ID:kylenave,项目名称:nosh-core,代码行数:28,代码来源:LoginController.php

示例3: googleoauth_refresh

 protected function googleoauth_refresh($practice_id)
 {
     $practice = DB::table('practiceinfo')->where('practice_id', '=', $practice_id)->first();
     if ($practice->google_refresh_token != '') {
         $file = File::get(__DIR__ . "/../../.google");
         $file_arr = json_decode($file, true);
         $client_id = $file_arr['web']['client_id'];
         $client_secret = $file_arr['web']['client_secret'];
         $google = new Google_Client();
         $google->setClientID($client_id);
         $google->setClientSecret($client_secret);
         $google->refreshToken($practice->google_refresh_token);
         $credentials = $google->getAccessToken();
         $result = json_decode($credentials, true);
         $data['smtp_pass'] = $result['access_token'];
         DB::table('practiceinfo')->where('practice_id', '=', $practice_id)->update($data);
         return true;
     } else {
         return false;
     }
 }
开发者ID:kylenave,项目名称:nosh-core,代码行数:21,代码来源:BaseController.php


注:本文中的Google_Client::setClientID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。