public function index() { $this->id = "content"; $this->template = "login/login.tpl"; $this->layout = "common/layout-empty"; if (Registry::get('username')) { header("Location: search.php"); exit; } $request = Registry::get('request'); $session = Registry::get('session'); $db = Registry::get('db'); $this->load->model('user/auth'); $this->load->model('user/user'); $this->load->model('user/prefs'); $this->load->model('domain/domain'); $this->load->model('folder/folder'); if (ENABLE_SAAS == 1) { $this->load->model('saas/ldap'); $this->load->model('saas/customer'); } $this->data['title'] = $this->data['text_login']; $this->data['title_prefix'] = TITLE_PREFIX; $this->data['failed_login_count'] = $this->model_user_auth->get_failed_login_count(); if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate() == true) { if ($this->model_user_auth->checkLogin($this->request->post['username'], $_POST['password']) == 1) { if ($session->get("ga_block") == 1) { header("Location: " . SITE_URL . "index.php?route=login/ga"); exit; } else { $this->model_user_prefs->get_user_preferences($session->get('username')); if (ENABLE_SAAS == 1) { $this->model_saas_customer->online($session->get('email')); } LOGGER('logged in'); if (isAdminUser() == 1) { header("Location: " . SITE_URL . "index.php?route=health/health"); exit; } header("Location: " . SITE_URL . "search.php"); exit; } } else { $this->model_user_auth->increment_failed_login_count($this->data['failed_login_count']); $this->data['failed_login_count']++; } $this->data['x'] = $this->data['text_invalid_email_or_password']; } if (ENABLE_GOOGLE_LOGIN == 1) { $client = new apiClient(); $client->setApplicationName(GOOGLE_APPLICATION_NAME); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://mail.google.com/')); $client->setClientId(GOOGLE_CLIENT_ID); $client->setClientSecret(GOOGLE_CLIENT_SECRET); $client->setRedirectUri(GOOGLE_REDIRECT_URL); $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); $this->data['auth_url'] = $client->createAuthUrl(); } $this->render(); }
private function getGoogleClient($config) { require_once LIBS_DIR . '/google-api-php-client/src/apiClient.php'; require_once LIBS_DIR . '/google-api-php-client/src/contrib/apiOauth2Service.php'; $client = new apiClient(); $client->setApplicationName($config['application_name']); $client->setClientId($config['client_id']); $client->setClientSecret($config['client_secret']); $client->setRedirectUri($config['redirect_url']); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email')); return $client; }
/** * connect */ protected function connect() { $client = new apiClient(); $client->setApplicationName("Google Application"); //*********** Replace with Your API Credentials ************** $client->setClientId($this->clientId); $client->setClientSecret($this->clientSecret); $client->setRedirectUri($this->redirectUri); // $client->setDeveloperKey('AIzaSyBiUF9NmJKGwbJCDOQIoF2NxMgtYjwI1c8'); //************************************************************ $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email')); return $client; }
public function index() { $this->id = "content"; $this->template = "login/login.tpl"; $this->layout = "common/layout"; $request = Registry::get('request'); $db = Registry::get('db'); $session = Registry::get('session'); $this->load->model('user/auth'); $this->load->model('user/user'); $this->load->model('user/prefs'); $this->load->model('user/google'); $this->load->model('domain/domain'); $this->load->model('folder/folder'); $this->document->title = $this->data['text_login']; $client = new apiClient(); $client->setApplicationName(GOOGLE_APPLICATION_NAME); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://mail.google.com/')); $client->setClientId(GOOGLE_CLIENT_ID); $client->setClientSecret(GOOGLE_CLIENT_SECRET); $client->setRedirectUri(GOOGLE_REDIRECT_URL); $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); $oauth2 = new apiOauth2Service($client); if (isset($_GET['code'])) { $client->authenticate(); $session->set("access_token", $client->getAccessToken()); header('Location: ' . GOOGLE_REDIRECT_URL); } if ($session->get("access_token")) { $client->setAccessToken($session->get("access_token")); } if ($client->getAccessToken()) { $session->set("access_token", $client->getAccessToken()); $token = json_decode($session->get("access_token")); if (isset($token->{'access_token'}) && isset($token->{'refresh_token'})) { $account = $oauth2->userinfo->get(); $this->model_user_google->check_for_account($account); $this->model_user_google->update_tokens($account['email'], $account['id'], $token); header("Location: " . SITE_URL . "search.php"); exit; } } $this->render(); }
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../server.php'; require_once '../../key.php'; require_once 'src/apiClient.php'; session_start(); $client = new apiClient(); $client -> setApplicationName('Google Contacts'); $client -> setScopes("http://www.google.com/m8/feeds/"); $client -> setClientId(GOOGLE_CLIENT_ID); $client -> setClientSecret(GOOGLE_CLIENT_SECRET); $client -> setRedirectUri(AUTH_BASE_URL . '/gmail/index.php'); //$client->setDeveloperKey('insert_your_developer_key'); if (isset($_GET['code'])) { $client -> authenticate(); $_SESSION['token'] = $client -> getAccessToken(); } $match = false; if (isset($_SESSION['token']))
* Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../../src/apiClient.php'; defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); $client = new apiClient(); // Visit https://code.google.com/apis/console to // generate your oauth2_client_id, oauth2_client_secret, and to // register your oauth2_redirect_uri. //$client->setClientId('INSERT_CLIENT_ID'); //$client->setClientSecret('INSERT_CLIENT_SECRET'); $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/latitude', 'https://www.googleapis.com/auth/moderator', 'https://www.googleapis.com/auth/tasks', 'https://www.googleapis.com/auth/siteverification', 'https://www.googleapis.com/auth/urlshortener', 'https://www.googleapis.com/auth/adsense.readonly')); $authUrl = $client->createAuthUrl(); print "Please visit:\n{$authUrl}\n\n"; print "Please enter the auth code:\n"; $authCode = trim(fgets(STDIN)); $_GET['code'] = $authCode; $accessToken = $client->authenticate(); var_dump($accessToken);
<?php require_once 'login/src/apiClient.php'; require_once 'login/src/contrib/apiOauth2Service.php'; $client = new apiClient(); $client->setApplicationName("flowerforevervn"); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email')); //echo $authUrl = $client->createAuthUrl(); $oauth2 = new apiOauth2Service($client); if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); } if (isset($_REQUEST['logout'])) { unset($_SESSION['token']); unset($_SESSION['google_data']); //Google session data unset $client->revokeToken(); } if ($client->getAccessToken()) { $user = $oauth2->userinfo->get(); //$_SESSION['google_data']=$user; // Storing Google User Data in Session header("location: home.php"); $_SESSION['token'] = $client->getAccessToken(); } else { $authUrl = $client->createAuthUrl();
* See the License for the specific language governing permissions and * limitations under the License. */ require_once 'apiClient.php'; require_once 'apiPredictionService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Google Prediction API PHP Starter Application"); // Visit https://code.google.com/apis/console/?api=prediction to generate // your oauth2_client_id, oauth2_client_secret, and to register your // oauth2_redirect_uri. // $client->setClientId('insert_your_oauth2_client_id'); // $client->setClientSecret('insert_your_oauth2_client_secret'); // $client->setRedirectUri('insert_your_oauth2_redirect_uri'); // $client->setDeveloperKey('insert_your_developer_key'); $client->setScopes(array('https://www.googleapis.com/auth/prediction')); $predictionService = new apiPredictionService($client); $trainedmodels = $predictionService->trainedmodels; if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['access_token'])) { $client->setAccessToken($_SESSION['access_token']); } if ($client->getAccessToken()) {
public function test_service() { App::import("Vendor", "GoogleApiClient", array("file" => "google-api-php-client/src/apiClient.php")); App::import("Vendor", "GoogleApiClient", array("file" => "google-api-php-client/src/contrib/apiBigqueryService.php")); $apiClient = new apiClient(); $apiClient->setApplicationName("Testing App"); $apiClient->setClientId("*****@*****.**"); $apiClient->setClientSecret("dhWNmyamq9LPLfMpWStQbmww"); $apiClient->setRedirectUri("http://" . $_SERVER['HTTP_HOST'] . "/tester/goog_callback"); $apiClient->setScopes(array('https://www.googleapis.com/auth/bigquery')); $apiClient->authenticate(); }
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once 'src/apiClient.php'; require_once 'src/contrib/apiPlusService.php'; //session_start(); $client = new apiClient(); $client->setApplicationName("Takescript"); $client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile')); $plus = new apiPlusService($client); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } if (isset($_SESSION['access_token'])) { $client->setAccessToken($_SESSION['access_token']); } if ($client->getAccessToken()) { $me = $plus->people->get('me'); $optParams = array('maxResults' => 100);
<?php session_start(); require_once "../src/apiClient.php"; $client = new apiClient(); $client->discover('plus'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me')); if (isset($_GET['logout'])) { unset($_SESSION['token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['token'] = $client->getAccessToken(); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); $ret = apiBatch::execute($client->plus->activities->list(array('userId' => 'me', 'collection' => 'public'), 'listActivities'), $client->plus->people->get(array('userId' => 'me'), 'getPerson')); print "<pre>" . print_r($ret, true) . "</pre>"; } else { $client->authenticate(); }
* See the License for the specific language governing permissions and * limitations under the License. */ if (ini_get('register_globals') === "1") { die("register_globals must be turned off before using the starter application"); } require_once 'google-api-php-client/src/apiClient.php'; require_once 'google-api-php-client/src/contrib/apiPlusService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Get Friends Id"); $client->setClientId('1057327068472.apps.googleusercontent.com'); $client->setClientSecret('EOO__L0l3dn2i97W1OHN8KT8'); $client->setRedirectUri('http://localhost/googleplus/initialize.php'); $client->setDeveloperKey('AIzaSyCoR7Exd0QXZsvE8q5CaLGtVnAM3RPGeQY'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://www.google.com/m8/feeds/')); $plus = new apiPlusService($client); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['access_token'])) { $client->setAccessToken($_SESSION['access_token']); } if ($client->getAccessToken()) { $oToken = json_decode($client->getAccessToken());
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../../src/apiClient.php'; defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); global $apiConfig; // Visit https://code.google.com/apis/console to // generate your oauth2_client_id, oauth2_client_secret, and to // register your oauth2_redirect_uri. //$apiConfig['oauth2_client_id'] = 'INSERT_CLIENT_ID'; //$apiConfig['oauth2_client_secret'] = 'INSERT_CLIENT_SECRET'; $apiConfig['oauth2_redirect_uri'] = 'urn:ietf:wg:oauth:2.0:oob'; $apiConfig['authClass'] = 'apiOAuth2'; $client = new apiClient(); $client->setScopes(array('https://www.googleapis.com/auth/buzz', 'https://www.googleapis.com/auth/latitude', 'https://www.googleapis.com/auth/moderator', 'https://www.googleapis.com/auth/tasks', 'https://www.googleapis.com/auth/siteverification', 'https://www.googleapis.com/auth/urlshortener')); $authUrl = $client->createAuthUrl(); print "Please visit:\n{$authUrl}\n\n"; print "Please enter the auth code:\n"; $authCode = trim(fgets(STDIN)); $_GET['code'] = $authCode; $accessToken = $client->authenticate(); var_dump($accessToken);
/** * Initialize G+ service * @return apiPlusService */ private function initializeGooglePlusService() { //get config $nlGooglePlusIni = eZINI::instance('nlgoogleplus.ini'); //initialize Google+ API $client = new apiClient(); $client->setApplicationName("NL Google Plus for eZ Publish"); // Visit https://code.google.com/apis/console to generate your // oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri. $client->setClientId($nlGooglePlusIni->variable('GooglePlus', 'ClientId')); $client->setClientSecret($nlGooglePlusIni->variable('GooglePlus', 'ClientSecret')); $client->setDeveloperKey($nlGooglePlusIni->variable('GooglePlus', 'DeveloperKey')); $client->setScopes(array($nlGooglePlusIni->variable('GooglePlus', 'Scope'))); //$client->setUseObjects(true); return new apiPlusService($client); }
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ define('AUTH_SERVICE', 'google'); require_once '../server.php'; require_once 'googleapi/apiClient.php'; $client = new apiClient(); $client -> setApplicationName('tarfee.com'); $client -> setScopes(array( "https://www.googleapis.com/auth/userinfo#email", "https://www.googleapis.com/auth/userinfo.profile" )); $client -> setClientId('846960227424-ngvickr83gflg38ehvapum82pm2jsefi.apps.googleusercontent.com'); $client -> setClientSecret('V4gH-18OqEqmilcSLQ1g5OyV'); $client -> setRedirectUri(AUTH_BASE_URL . '/google/index.php'); $access_token = NULL; if (isset($_REQUEST['error']) && $_REQUEST['error'] == 'access_denied') { processDeniedAndExit('gmail'); exit(); } if (isset($_GET['code']))
* See the License for the specific language governing permissions and * limitations under the License. */ if (ini_get('register_globals') === "1") { die("register_globals must be turned off before using the starter application"); } require_once 'google-api-php-client/src/apiClient.php'; require_once 'google-api-php-client/src/contrib/apiPlusService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Google+ PHP Starter Application"); $client->setClientId('583952610464-skm0ipo4hms1qleut4jinp106fnf0daf.apps.googleusercontent.com'); $client->setClientSecret('FijubFKkMgXvH-UQV4SfEypV'); $client->setRedirectUri('http://localhost/googleplus/index.php'); $client->setDeveloperKey('AIzaSyDidZKyQlgizNL3lgPRHDyucL5sOxqGqXg'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://picasaweb.google.com/data/')); $plus = new apiPlusService($client); if (isset($_REQUEST['logout'])) { $files = glob('images/*'); // get all file names foreach ($files as $file) { // iterate files if (is_file($file)) { unlink($file); } // delete file } unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate();
define('ROOT_PATH', realpath(dirname(__FILE__) . '/../') . '/'); require ROOT_PATH . 'lib/boot/bootstrap.php'; session_start(); $token = "ya29.AHES6ZSi8xWxhiidj5s4BlP0_OotCaNbP5NBwh_dkok9rHiDY-OmQA"; $docs = new Googledocs(); $results = array(); $docInfo = array(); if (!getParam('action')) { $results = $docs->getDocs($token); } else { $docInfo = $docs->getDoc(getParam('docId'), $token); } require_once "src/apiClient.php"; $client = new apiClient(); $client->discover('plus'); $client->setScopes(array('http://docs.google.com/feeds/')); if (isset($_GET['logout'])) { unset($_SESSION['token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); } else { //$client->authenticate(); } ?>
<?php require_once 'src/apiClient.php'; require_once 'src/contrib/apiPlusService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Kindle Reader"); $client->setScopes(array('https://www.google.com/reader/api')); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['access_token'])) { $client->setAccessToken($_SESSION['access_token']); } if ($client->getAccessToken()) { $_SESSION['access_token'] = $client->getAccessToken(); header('Location: sender.php'); } else { $status = "Logged Out"; $authUrl = $client->createAuthUrl(); header('Location: ' . $authUrl); }
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../../src/apiClient.php'; require_once '../../src/contrib/apiGanService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Google Apps PHP Starter Application"); $client->setScopes(array('https://apps-apis.google.com/a/feeds/groups/', 'https://apps-apis.google.com/a/feeds/alias/', 'https://apps-apis.google.com/a/feeds/user/')); // Documentation: http://code.google.com/googleapps/domain/provisioning_API_v2_developers_guide.html // Visit https://code.google.com/apis/console to generate your // oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri. // $client->setClientId('insert_your_oauth2_client_id'); // $client->setClientSecret('insert_your_oauth2_client_secret'); // $client->setRedirectUri('insert_your_oauth2_redirect_uri'); // $client->setDeveloperKey('insert_your_simple_api_key'); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));