当前位置: 首页>>代码示例>>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方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     include_once AB_PATH . '/lib/google_api_v3/autoload.php';
     $this->client = new Google_Client();
     $this->client->setClientId(get_option('ab_settings_google_client_id'));
     $this->client->setClientSecret(get_option('ab_settings_google_client_secret'));
 }
开发者ID:patrickcurl,项目名称:monks,代码行数:7,代码来源:AB_Google.php

示例2: __construct

 public function __construct($oauthClientId, $oauthClientSecret, $oAuthConfig = array())
 {
     $this->client = new \Google_Client();
     $this->client->setClassConfig('Google_Auth_OAuth2', $oAuthConfig);
     $this->client->setClientId($oauthClientId);
     $this->client->setClientSecret($oauthClientSecret);
 }
开发者ID:andywooyay,项目名称:AwyGoogleApiBundle,代码行数:7,代码来源:GoogleClient.php

示例3: __construct

 /**
  * Google constructor.
  */
 public function __construct()
 {
     $this->_googleClient = new \Google_Client();
     $this->_googleClient->setClientId(KACANA_SOCIAL_GOOGLE_KEY);
     $this->_googleClient->setClientSecret(KACANA_SOCIAL_GOOGLE_SECRET);
     $this->_googleClient->setApplicationName(KACANA_SOCIAL_GOOGLE_APP_NAME);
     $this->_googleClient->setRedirectUri('postmessage');
 }
开发者ID:kacana,项目名称:kacana.com,代码行数:11,代码来源:Google.php

示例4: __construct

 /**
  * @param \Google_Client $client
  */
 public function __construct(\Google_Client $client)
 {
     $this->client = $client;
     $this->client->setClientId(\Config::get('google.client_id'));
     $this->client->setClientSecret(\Config::get('google.client_secret'));
     $this->client->setDeveloperKey(\Config::get('google.api_key'));
     $this->client->setRedirectUri(\Config::get('app.url') . "/loginCallback");
     $this->client->setScopes(['https://www.googleapis.com/auth/youtube']);
     $this->client->setAccessType('offline');
 }
开发者ID:janusnic,项目名称:YoutubeAPI_Demo,代码行数:13,代码来源:GoogleLogin.php

示例5: __construct

 /**
  * Google
  * @param $params array - data from config.neon
  * @param $cookieName String cookie name
  * @param Nette\Http\Response $httpResponse
  * @param Nette\Http\Request $httpRequest
  */
 public function __construct($params, $cookieName, Nette\Http\Response $httpResponse, Nette\Http\Request $httpRequest)
 {
     $this->params = $params;
     $this->cookieName = $cookieName;
     $this->httpResponse = $httpResponse;
     $this->httpRequest = $httpRequest;
     $this->client = new \Google_Client();
     $this->client->setClientId($this->params["clientId"]);
     $this->client->setClientSecret($this->params["clientSecret"]);
     $this->client->setRedirectUri($this->params["callbackURL"]);
 }
开发者ID:venca-x,项目名称:social-login,代码行数:18,代码来源:GoogleLogin.php

示例6: __construct

 /**
  * Constructor.
  *
  * @param int $repositoryid repository instance id.
  * @param int|stdClass $context a context id or context object.
  * @param array $options repository options.
  * @param int $readonly indicate this repo is readonly or not.
  * @return void
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array(), $readonly = 0)
 {
     parent::__construct($repositoryid, $context, $options, $readonly = 0);
     $callbackurl = new moodle_url(self::CALLBACKURL);
     $this->client = get_google_client();
     $this->client->setClientId(get_config('googledocs', 'clientid'));
     $this->client->setClientSecret(get_config('googledocs', 'secret'));
     $this->client->setScopes(array(Google_Service_Drive::DRIVE_READONLY));
     $this->client->setRedirectUri($callbackurl->out(false));
     $this->service = new Google_Service_Drive($this->client);
     $this->check_login();
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:21,代码来源:lib.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param int $repositoryid repository instance id.
  * @param int|stdClass $context a context id or context object.
  * @param array $options repository options.
  * @param int $readonly indicate this repo is readonly or not.
  * @return void
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array(), $readonly = 0)
 {
     parent::__construct($repositoryid, $context, $options, $readonly = 0);
     $callbackurl = new moodle_url(self::CALLBACKURL);
     $this->client = new Google_Client();
     $this->client->setClientId(get_config('googledocs', 'clientid'));
     $this->client->setClientSecret(get_config('googledocs', 'secret'));
     $this->client->setScopes(array('https://www.googleapis.com/auth/drive.readonly'));
     $this->client->setRedirectUri($callbackurl->out(false));
     $this->service = new Google_DriveService($this->client);
     $this->check_login();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:21,代码来源:lib.php

示例8: __construct

 /**
  * Google
  * @param $params array - data from config.neon
  * @param $cookieName String cookie name
  * @param Nette\Http\Response $httpResponse
  * @param Nette\Http\Request $httpRequest
  */
 public function __construct($params, $cookieName, Nette\Http\Response $httpResponse, Nette\Http\Request $httpRequest)
 {
     $this->params = $params;
     $this->cookieName = $cookieName;
     $this->httpResponse = $httpResponse;
     $this->httpRequest = $httpRequest;
     $config = new \Google_Config();
     $config->setClassConfig('Google_Cache_File', array('directory' => '/temp/cache'));
     $this->client = new \Google_Client($config);
     $this->client->setClientId($this->params["clientId"]);
     $this->client->setClientSecret($this->params["clientSecret"]);
     $this->client->setRedirectUri($this->params["callbackURL"]);
 }
开发者ID:knedle,项目名称:twitter-nette-skeleton,代码行数:20,代码来源:GoogleLogin.php

示例9: initializeClient

 public function initializeClient()
 {
     $this->client = new Client();
     $this->client->setAccessType('offline');
     $this->client->setApplicationName('playlister');
     $this->client->setClientId($this->config->get('services.youtube.client_id'));
     $this->client->setClientSecret($this->config->get('services.youtube.client_secret'));
     $this->client->setRedirectUri($this->config->get('services.youtube.redirect'));
     $this->client->setDeveloperKey($this->config->get('services.youtube.api_key'));
     $this->client->addScope('https://www.googleapis.com/auth/youtube.readonly');
     if ($this->auth->check() && $this->request->session()->has('user.token')) {
         $this->setToken($this->request->session()->get('user.token'));
     }
 }
开发者ID:JoeAlamo,项目名称:Playlister,代码行数:14,代码来源:YoutubeAPIService.php

示例10: __construct

 /**
  * Sets the required params for authentication 
  * 
  * @param string $client_id our app's client id
  * @param string $client_secret our app's client secret 
  * @param string $redirect_uri where will the auth server send the client 
  * after generating an authorization code to authenticate
  * @param null|string $token token obtained when a code is authenticated
  * @param null|string $code response code to authenticate
  * @param null|array $scopes array of strings with OAuth2/google scopes 
  * to requested
  * @param null|Google_Client $client
  * @param bool $debug defaults to false
  */
 public function __construct($client_id, $client_secret, $redirect_uri, $token = null, $code = null, $scopes = null, $client = null, $debug = null)
 {
     $this->client_id = $client_id;
     $this->client_secret = $client_secret;
     $this->redirect_uri = $redirect_uri;
     $this->code = $code;
     $this->token = $token;
     if ($scopes !== null) {
         $this->scopes = $scopes;
     }
     if (is_bool($this->debug)) {
         $this->debug = $debug;
     } else {
         $this->debug = false;
     }
     if ($client === null) {
         $this->client = new Google_Client();
         $this->client->setClientId($this->client_id);
         $this->client->setClientSecret($this->client_secret);
         $this->client->setRedirectUri($this->redirect_uri);
         if ($token !== null) {
             $this->client->setAccessToken($token);
         }
         $this->client->setScopes($this->scopes);
     }
 }
开发者ID:elcodedocle,项目名称:gplusraffle,代码行数:40,代码来源:User.php

示例11: googleCallbackAction

 public function googleCallbackAction()
 {
     $response = array("status" => 0, "message" => "Thao tác không thành công");
     $code = $this->request->getPost("code", null, false);
     if ($code) {
         $google = new \Google_Client();
         $google->setApplicationName($this->config["GOOGLE_NAME"]);
         $google->setClientId($this->config["GOOGLE_ID"]);
         $google->setClientSecret($this->config["GOOGLE_SECRET"]);
         $google->setRedirectUri('postmessage');
         $scopes = array("https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email");
         $google->setScopes($scopes);
         $google->authenticate($code);
         $request = new \Google_Http_Request("https://www.googleapis.com/oauth2/v2/userinfo?alt=json");
         $userinfo = $google->getAuth()->authenticatedRequest($request);
         $response = $userinfo->getResponseBody();
         $userinfo = json_decode($response, true);
         $id = $userinfo["id"];
         $username = explode("@", $userinfo["email"]);
         $username = $username[0] . "_gg_" . $id;
         $data_user = array("email" => $userinfo["email"], "nickname" => $userinfo["name"], "username" => $username, "id" => $id);
         $response = $this->doSocialLogin($data_user);
     }
     echo json_encode($response);
     exit;
 }
开发者ID:nbtai,项目名称:haiquan,代码行数:26,代码来源:UserController.php

示例12: call_back

 public function call_back()
 {
     $config = new Controllers_Api_Google_Config_App();
     $client = new Google_Client();
     $client->setClientId($config->config['client_id']);
     $client->setClientSecret($config->config['client_secret']);
     $client->setRedirectUri($config->config['redirect_uri']);
     $client->addScope("email");
     $client->addScope("profile");
     $service = new Google_Service_Oauth2($client);
     if (isset($_GET['code'])) {
         $client->authenticate($_GET['code']);
         $_SESSION['access_token'] = $client->getAccessToken();
         header('Location: ' . filter_var($config->config['redirect_uri'], FILTER_SANITIZE_URL));
         exit;
     }
     /************************************************
         If we have an access token, we can make
         requests, else we generate an authentication URL.
        ************************************************/
     if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
         $client->setAccessToken($_SESSION['access_token']);
     } else {
         $authUrl = $client->createAuthUrl();
     }
     if (isset($authUrl)) {
         //show login url
         echo json_encode(array('status' => false, 'data' => $authUrl));
     } else {
         $user = $service->userinfo->get();
         //get user info
         echo json_encode(array('status' => true, 'data' => $user));
     }
 }
开发者ID:anovanmaximuz,项目名称:sosmed-cms,代码行数:34,代码来源:post.php

示例13: authorizeGoogleUser

 function authorizeGoogleUser($access_code)
 {
     $client = new \Google_Client();
     $google = $this->config->google;
     $client->setApplicationName('Portal da Rede');
     $client->setClientId($google->clientId);
     $client->setClientSecret($google->secret);
     $client->setRedirectUri('postmessage');
     $client->addScope('https://www.googleapis.com/auth/userinfo.profile');
     $client->addScope('https://www.googleapis.com/auth/userinfo.email');
     $client->authenticate($access_code);
     $json_token = $client->getAccessToken();
     $client->setAccessToken($json_token);
     $plus = new \Google_Service_Plus($client);
     $user = $plus->people->get('me');
     if (!$user->emails || !is_array($user->emails)) {
         return;
     }
     $email = $user->emails[0]['value'];
     $user_email = $this->db->user_email->find_one($email);
     if (!$user_email) {
         return;
     }
     $this->login($user_email->user);
 }
开发者ID:kahvazquez,项目名称:trouble,代码行数:25,代码来源:User.php

示例14: getClient

function getClient()
{
    $config = (include __DIR__ . '/ini.php');
    $client = new Google_Client();
    $client->setApplicationName("Webkameleon");
    $client->setClientId($config['oauth2_client_id']);
    $client->setClientSecret($config['oauth2_client_secret']);
    $client->setRedirectUri($config['oauth2_redirect_uri']);
    $client->setScopes($config['oauth2_scopes']);
    $client->setState('offline');
    $client->setAccessType('offline');
    $client->setApprovalPrompt('force');
    if (isset($_GET['code'])) {
        $client->authenticate($_GET['code']);
        die($client->getAccessToken());
    } elseif (!isset($config['token'])) {
        Header('Location: ' . $client->createAuthUrl());
    } else {
        $client->setAccessToken($config['token']);
        if ($client->isAccessTokenExpired()) {
            $token = json_decode($config['token'], true);
            $client->refreshToken($token['refresh_token']);
        }
    }
    return $client;
}
开发者ID:podstawski,项目名称:appengine,代码行数:26,代码来源:google.php

示例15: createClient

 private function createClient()
 {
     $options = ['auth' => 'google_auth', 'exceptions' => false];
     if ($proxy = getenv('HTTP_PROXY')) {
         $options['proxy'] = $proxy;
         $options['verify'] = false;
     }
     // adjust constructor depending on guzzle version
     if (!$this->isGuzzle6()) {
         $options = ['defaults' => $options];
     }
     $httpClient = new GuzzleHttp\Client($options);
     $client = new Google_Client();
     $client->setApplicationName('google-api-php-client-tests');
     $client->setHttpClient($httpClient);
     $client->setScopes(["https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/tasks", "https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/youtube", "https://www.googleapis.com/auth/drive"]);
     if ($this->key) {
         $client->setDeveloperKey($this->key);
     }
     list($clientId, $clientSecret) = $this->getClientIdAndSecret();
     $client->setClientId($clientId);
     $client->setClientSecret($clientSecret);
     $client->setCache($this->getCache());
     return $client;
 }
开发者ID:knedle,项目名称:twitter-nette-skeleton,代码行数:25,代码来源:BaseTest.php


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