google-api-php-client

Implementing Oauth2 login, Fatal error: Class 'Google_Service' not found

江枫思渺然 提交于 2019-11-27 22:28:36
I am updating my website's login system from LightOpenID to Google's Oauth 2.0. When I require the Client.php and the Service/Oauth2.php I get an error Fatal error: Class 'Google_Service' not found in /home/myname/repos/website_current/lib/google-api-php-client/src/Google/Service/Oauth2.php on line 32 The code I am using (from my login.php file) looks like this require_once(dirname($_SERVER['DOCUMENT_ROOT']).'/lib/autoload.php'); require('Google/Client.php'); require('Google/Service/Oauth2.php'); echo "exit"; exit(); I have added the include path in the PHP.ini (in /etc/php5/apache2/php.ini)

Google API Client “refresh token must be passed in or set as part of setAccessToken”

无人久伴 提交于 2019-11-27 20:12:50
I am currently facing a very strange problem, indeed I've been following this very same guide ( https://developers.google.com/google-apps/calendar/quickstart/php ) from Google API documentation. I tried it twice, at the first time it work like a charm but after the access token had expire the script provided straight by Google API Doc was unable to refresh it. TL;DR Here is the error message: sam@ssh:~$ php www/path/to/app/public/quickstart.php Fatal error: Uncaught exception 'LogicException' with message 'refresh token must be passed in or set as part of setAccessToken' in /home/pueblo/www

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP — getting 401 (unauthorized) message

∥☆過路亽.° 提交于 2019-11-27 19:04:19
问题 I have to implement a way to upload video from our site to youtube. I already registered the app in Google Cloud and got all the necessary client ID, client secret code, browser key, redirect uri and server key. I also did turn ON the Youtube Data API V3, Google+ API, Freebase API and YouTube Analytics API as suggessted by various sites. Here is my code below: require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_YouTubeService.php'

Google api refresh_token null and how to refresh access token

只愿长相守 提交于 2019-11-27 15:19:51
I use HWIO Bundle for google api and when I have response from google refreshToken = null why? How to refresh token oAuthToken = {HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken} [11] accessToken = "ya29.Ci8lA1JTu9CB81dOFy-nzszViRgCI2CvvKVrCd0Lq-8I0QR_dIrl-_7RccdGt1Islg" rawToken = {array} [4] access_token = "ya29.Ci8lA1JTu9CB81dOFy-nzszViRgCI2CvvKVrCd0Lq-8I0QR_dIrl-_7RccdGt1Islg" token_type = "Bearer" expires_in = 3578 id_token = "xxxxx" refreshToken = null expiresIn = 3578 createdAt = 1468957368 tokenSecret = null resourceOwnerName = null because in google/apiclient,

Google Drive API - PHP Client Library - setting uploadType to resumable upload

烂漫一生 提交于 2019-11-27 15:12:32
I am having serious issues with the documentation for the new google drive API client library. It seems this should be an easy one to answer without having to put it on stackoverflow. I am seriously considering rolling my own on this one, a 64 page library that "just works" is so far a "total headache" How the heck do you set the uploadType to "resumable" instead of the default "simple". I have searched the library for a way to do this, but it seems non-existent. Their only hint is the code on their sample uploader page https://developers.google.com/drive/quickstart-php //Insert a file $file =

Use service account to verify Google InAppPurchase

我的未来我决定 提交于 2019-11-27 14:53:39
问题 I've tried so many things in the last days but now I'm out of ideas :( I want to verify an inAppPurchase that has been made in my android app. 1) I created a new service account in the google API console. 1a) The service account is listed unter permissions and has "can view" permission 2) I'm using the most current version of https://github.com/google/google-api-php-client 3) code snippet from my PHP script: $client = new Google_Client(); $client->setApplicationName('myAppName' ); $client-

Google Analytics API - Get page view information for specific URLs

坚强是说给别人听的谎言 提交于 2019-11-27 10:21:30
I am looking to implement a page view tracking system on one of my websites. The website is a directory where suppliers can advertise their services. Suppliers have a unique profile page on the site, e.g mysite.com/directory/abc-profile.html The idea is that suppliers can log in to their account area on the site and view stats on how many people are visiting their profile. Ideally I want to display this as : Total views | Total today | This week | This month | This year It does not matter if the data is not completely up to date. I already have Google Analytics tracking code installed on the

Automatically refresh token using google drive api with php script

不问归期 提交于 2019-11-27 07:43:20
I followed again THIS TUTORIAL to upload a file on Google Drive with php, directly from my REMOTE SERVER: so I have created new API Project from Google API Console, enabled Drive API service, requested OAuth Client ID and Client Secret, wrote them in a script, then upload it together with Google APIs Client Library for PHP folder to this http://www.MYSERVER.com/script1.php , to retrieve Auth code: <?php require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_DriveService.php'; $drive = new Google_Client(); $drive->setClientId('XXX'); /

Google PHP API Client & Fusion Tables: How to use importRows?

那年仲夏 提交于 2019-11-27 07:17:06
问题 Version 0.6.3 of the Google API php Client appears to support the importRows command: public function importRows($tableId, $optParams = array()) { $params = array('tableId' => $tableId); $params = array_merge($params, $optParams); $data = $this->__call('importRows', array($params)); if ($this->useObjects()) { return new Google_Import($data); } else { return $data; } } The importRows documentation doesn't really coincide with the way the function has been implemented in the php Client, as

Gmail API returns 403 error code and “Delegation denied for <user email>”

て烟熏妆下的殇ゞ 提交于 2019-11-27 04:30:00
Gmail API fails for one domain when retrieving messages with this error: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 OK { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Delegation denied for <user email>", "reason" : "forbidden" } ], "message" : "Delegation denied for <user email>" } I am using OAuth 2.0 and Google Apps Domain-Wide delegation of authority to access the user data. The domain has granted data access rights to the application. Seems like best thing to do is to just always have userId="me" in your requests. That tells the API to just use