google-api-php-client

How do I use Composer to setup google-api-php-client?

帅比萌擦擦* 提交于 2019-12-06 05:00:56
There seems to be some gaps in the instructions, a little help? Step 1: Easily access Google APIs from PHP , sounds easy! Step 2: Install the library , you can install the library by adding it as a dependency to your "composer.json". Never heard of composer, never used json. All I need to do is add "require": {"google/apiclient": "1.0.*@beta"} to my composer.json Step 3: Composer requires Linux, but isn't the whole point of using App Engine so I don't have to deal with Linux? Ok, setup Debian on Compute Engine and added the following, "sudo curl -sS https://getcomposer.org/installer | sudo php

Error refreshing the OAuth2 token { “error” : “invalid_grant” }

隐身守侯 提交于 2019-12-06 02:11:51
please help me to understand where mistake. API Google Api PHP v3, key.p12 is the file in the .zip collection API (or where i find it ?) I masked my data with xxxxxxxxxx Excuse me for my inglish gaphp.php <?php require_once 'Google/Client.php'; require_once 'Google/Service/Analytics.php'; $client_id = 'xxx-xxx.apps.googleusercontent.com'; $service_account_name = 'xxx-xxx@developer.gserviceaccount.com'; $keyfile = 'key.p12'; $redirect_url = 'http://example.com/service/ga/gaphp.php'; $client_secret = 'xxxxxxxxxxxxxxxxxxxxx'; // Initialise the Google Client object $client = new Google_Client();

Signed URL for google bucket does not match signature provided

喜欢而已 提交于 2019-12-06 01:36:07
I'm having an hard time working with google storage. So I'm trying to make a signed url , already have the client id (which is an email) and private key (as described here ) so: STEP 1: construct the string function googleBuildConfigurationString($method, $expiration, $file, array $options = []) { $allowedMethods = ['GET', 'HEAD', 'PUT', 'DELETE']; // initialize $method = strtoupper($method); $contentType = $options['Content_Type']; $contentMd5 = $options['Content_MD5'] ? base64_encode($options['Content_MD5']) : ''; $headers = $options['Canonicalized_Extension_Headers'] ? $options[

How do I authorize a google drive service account access to a google account without using google apps?

半腔热情 提交于 2019-12-06 01:31:40
问题 I'd like to use Google Drive to work as a quasi-CMS for a website I'm making so that the content owners can edit their content using Google Drive. I'd like to use a specific user account that has access to Google Drive (as of writing this post, service accounts DO NOT have direct access to Google Drive) and is able to share documents with the content owners. After reading through the API and tutorials, I have found the answer in delegation: https://developers.google.com/drive/delegation My

setAssertionCredentials on google-api-php-client 2.0

女生的网名这么多〃 提交于 2019-12-05 21:41:02
I updated from 1.1.5 to 2.0 and I cannot get it to login. I followed the UPGRADE.md instructions, on how to upgrade from using "setAssertionCredentials", but I can't get it to work. BEFORE: $client = new Google_Client(); $client->setApplicationName('API Project'); $client->setAssertionCredentials( new Google_Auth_AssertionCredentials( GAPI_SERVICE_ACCOUNT, array($service), file_get_contents(GAPI_KEYFILE) ) ); if ($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion(); }; $client->setClientId(GAPI_CLIENT_ID); $service = Google_Service_Webmasters($client);

Get Calendar events between two dates

ぃ、小莉子 提交于 2019-12-05 18:14:37
问题 How to get all events between two specific dates. For example i only want to get events between 1st of March 2013 & 28th of March 2013 . I am using Google Calendar API v3. While in Google Calendar API v1 there was the facility for search between 2 dates using start-min & start-max. I am wondering what is the replacement for these two parameters in Google Calendar API v3? 回答1: Ok i got the answer. The new parameters in Google API V3 are timeMin & timeMax to filter events between 2 dates. 回答2:

Unsupported content with type: multipart/form-data in google plus api oauth2

心不动则不痛 提交于 2019-12-05 15:41:08
I am trying to sign in with google plus Api in my web app. I searched on it from https://developers.google.com/oauthplayground/https://developers.google.com/oauthplayground/ and I applied them. When I request to https://www.googleapis.com/oauth2/v3/token , it returns { "error": "internal_failure", "error_description": "Unsupported content with type: multipart/form-data; boundary=----------------------------5dd1639f2986" } I am putting my code snippets which are doing the request (as client id and secret as star) I dont understand it, maybe you can help. if(isset($_GET['code'])) { // try to get

PHP Youtube API v3 - Direct Upload - Unauthorized message

岁酱吖の 提交于 2019-12-05 14:47:18
I'm trying to direct upload videos to Youtube with API v3. I'm using service account scenario ( https://developers.google.com/accounts/docs/OAuth2?hl=es&csw=1#scenarios ), and I solved some problems in the google-api-php-client library (to read the p12 file and to avoid the isAccessTokenExpired always return false). <?php /** Config */ $private_key_password = 'notasecret'; $private_key_file = 'xxxxxxxx-privatekey.p12'; $applicationName = 'xxxxx-youtube'; $client_secret = 'CLIENT_SECRET'; $client_id = 'xxxxxxxxxxxxx.apps.googleusercontent.com'; $service_mail = 'xxxxxxxxxxx@developer

Can't Validate Google Access Token (wrong number of segments)

一世执手 提交于 2019-12-05 13:21:21
I have very simple code directly from Google's website $client = new Google_Client(['client_id' => $CLIENT_ID]); $payload = $client->verifyIdToken($id_token); if ($payload) { $userid = $payload['sub']; echo $userid; } else { // Invalid ID token echo "error"; } I get the following error(s): <b>Fatal error</b>: Uncaught exception 'UnexpectedValueException' with message 'Wrong number of segments' in /../vendor/firebase/php-jwt/src/JWT.php:79 Stack trace: #0 /../vendor/google/apiclient/src/Google/AccessToken/Verify.php(103): Firebase\JWT\JWT::decode('ya29.GlzbAwEXTe...', '-----BEGIN PUBL...',

get raw rfc822 message from phpmailer

冷暖自知 提交于 2019-12-05 10:23:33
I am trying to use google-api-php-client and gmail-api to allow my users to authenticate their gmail accounts and send emails through my website. I asked a more generic questions earlier and decided to seek help from the PHPMailer community with this question. I have used PHPMailer to send emails. And I want to know if I can extract the raw rfc822 message from my PHPMailer object after setting it up prior to sending. I should be able to then do a base64_encode on that string and set the "raw" property for my Google_Service_Gmail_Message. No problem: Set up everything as if you were going to