本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}