google-api-php-client

Google Calendar Push Notification watch command in php

落爺英雄遲暮 提交于 2019-12-05 09:37:45
I am using the php watch commant: $service = new Google_Service_Calendar($client); $channel = new Google_Service_Calendar_Channel($client); $channel->setId('20fdedbf0-a845-11e3-1515e2-0800200c9a6689111'); $channel->setType('web_hook'); $channel->setAddress('https://www.exampel.com/app/notification'); $watchEvent = $service->events->watch('primary', $channel); This command works fine and I get the response: Google_Service_Calendar_Channel Object ( [address] => [expiration] => 1401960485000 [id] => 20fdedbf0-a845-11e3-1515e2-0800200c9a6689111 [kind] => api#channel [params] => [payload] =>

Uncaught exception 'Google_Auth_Exception' with message 'Could not json decode the token'

我的梦境 提交于 2019-12-05 06:33:18
I am using the user-example.php in the google-api-client-php library and it is throwing up the error Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Could not json decode the token' in /Applications/XAMPP/xamppfiles/htdocs/Calendar/google-api-php-client/src/Google/Auth/OAuth2.php:174 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/Calendar/google-api-php-client/src/Google/Client.php(196): Google_Auth_OAuth2->setAccessToken('[]') #1 /Applications/XAMPP/xamppfiles/htdocs/calendar/google-api-php-client/examples/user-example.php(80): Google_Client->setAccessToken('[]')

Create a sub folder using google-drive-api and return the id with PHP

天大地大妈咪最大 提交于 2019-12-05 06:14:22
I can create the sub folder just fine with the code below but I just can't return the id. I would like to get the id and/or the link to the folder so I can add them to my database. Currently the below creates the folder but just returns "//" as the id! Thanks for your help <?php if ($client->getAccessToken()) { $file = new Google_DriveFile(); //Setup the Folder to Create $file->setTitle('Project Folder'); $file->setDescription('A Project Folder'); $file->setMimeType('application/vnd.google-apps.folder'); //Set the ProjectsFolder Parent $parent = new Google_ParentReference(); $parent->setId(

Google Analytics API request returns captcha?

浪子不回头ぞ 提交于 2019-12-05 06:14:02
问题 Since yesterday, our connection to the Google Analytics API returns an HTML page with... captcha. Does anyone experience something like this? We use the API with the PHP library. Our code for retrieving a report (its wrapped in our own class but it uses the google/apiclient package): // Create analytics $this->analytics = new \Google_Service_AnalyticsReporting($this->client); // Create the ReportRequest object. $request = new \Google_Service_AnalyticsReporting_ReportRequest(); $request-

How can I manage OAuth refresh tokens with Laravel?

偶尔善良 提交于 2019-12-05 02:13:42
The Socialiate plugin provides an implementation for OAuth in Laravel, but it seems to be designed for mostly for the purpose of allowing them to not have to make a user account on your own site. I am making an application that helps manage their Youtube account, meaning the scope of the auth request is broader (which was easy to change) but I also need a refresh token (versus just an access token) for long-term access to their account. Is there a package out there for Laravel that already handles this? I haven't been able to find one, but maybe I'm searching for the wrong thing. If not, how

How to upload Video to YouTube using Google API PHP Client Library and Youtube API V3?

ε祈祈猫儿з 提交于 2019-12-04 19:52:53
问题 Trying to simply upload video using Google API PHP Client (latest release 1.1.6), but code in Youtube API V3 is not working and giving 500 internal server error. What is wrong with code below when I am not using any bleeding edge beta version, I have just masked 3 parameters below otherwise it is copied form Youtube API V3. require_once 'google-api-php-client/src/Google/Client.php'; require_once 'google-api-php-client/src/Google/Service/YouTube.php'; session_start(); $OAUTH2_CLIENT_ID =

curl error 35 : Unknown SSL google OAuth2

瘦欲@ 提交于 2019-12-04 17:19:09
I try to use Google php OAuth2 (google-api-php-client) and i have curl errno 35, but only when i use proxy : HTTP Error: (0) Unknown SSL protocol error in connection to accounts.google.com:8080 I test many solutions : // Test disabled verify peer & host CURLOPT_SSL_VERIFYPEER => false CURLOPT_SSL_VERIFYHOST => false ... // Test set proxy & auth proxy curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_PROXYPORT, '8080'); curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth); ... // Test set auth proxy in header curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization' => $proxyauth

refreshTokenWithAssertion Permission Denied

家住魔仙堡 提交于 2019-12-04 10:12:35
I am trying to use google-api-client in PHP for a project. I got a "permission denied" response while at this statement: $client->getAuth()->refreshTokenWithAssertion(); Google_IO_Exception, Message:Failed to connect to 74.125.193.84: Permission denied File: /home/www/blah.com/restful/libs/Google/IO/Curl.php Line:81 /home/www/blah.com/restful/libs/Google/IO/Abstract.php(125): Google_IO_Curl->executeRequest(Object(Google_Http_Request)) #1 /home/www/blah.com/restful/libs/Google/Auth/OAuth2.php(326): Google_IO_Abstract->makeRequest(Object(Google_Http_Request)) #2 /home/www/blah.com/restful/libs

Cannot get access token with Google Calendar Api v3

点点圈 提交于 2019-12-04 05:30:20
问题 I am trying to put a calendar event into a calendar without the authentication prompt. I have read that using an OAuth Service Account allows you to do this. I have set up the Service account in my Google Developer Console and am not having any luck with this. We have a Google business account and I am setting my delegated user to an admin of our account so they can access anyone's calendar but it will not create the event. I believe the issue is with the access token. When I var_dump(

Google API: “invalid_grant”, but the code haven't changed

懵懂的女人 提交于 2019-12-04 04:46:20
问题 I have the following problem with authentication to Google API: PHP Fatal error: Uncaught exception 'Google_Auth_Exception' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /home/bot/bot/vendor/google/apiclient/src/Google/Auth/OAuth2.php:328 However, the issue is very strange, because same code works on my local PC and stops working on the server. Is it possible, that it has something to do with server time? I have my system clock synchronized, but