google-api-php-client

What's the difference between api key, client id and service account?

荒凉一梦 提交于 2021-02-17 18:58:49
问题 I needed to access a Google's service, i.e. Google Analytics, from my Symfony 2 application, so I had to use the Google api client (version 2). Before accessing Google Analytics' info, I had to create either a api key, a client id or a service account in the Google API Console. At the end, I created a service account, and a file was downloaded. This file is used by the Google api client to grant access to my Google Analytics account and its respective collected info. My question are: What are

Identify logged in Google Account user with OAuth2.0

半世苍凉 提交于 2021-02-10 20:08:48
问题 I am developing a web application that uses OAuth2 to login the users with their Google Accounts. I am also accessing some Google Data APIs so I am asking for refresh tokens and offline access too( in case that it makes a difference ). My problem is the following : after the app's user first comes to login, does OAuth and I save the tokens/user id in the database, I need to have in place a system that identifies the user on subsequent visits. I do this by saving the Google user ID (obtained

How to get steps count with Google Fit api in php ?

你说的曾经没有我的故事 提交于 2021-02-07 08:51:46
问题 I got a problem with the Google Api Php Client and Google Fit . I want to get the sum of steps I made in a day. I found a response but it doesn't work (look at the gist). My php code: // Retrive oauth data $clientData = json_decode(file_get_contents("../Devbook-87e2bafd84e6.json")); $client_email = $clientData->client_email; $private_key = $clientData->private_key; $scopes = array(Google_Service_Fitness::FITNESS_ACTIVITY_READ); $credentials = new Google_Auth_AssertionCredentials( $client

How to get steps count with Google Fit api in php ?

自古美人都是妖i 提交于 2021-02-07 08:48:36
问题 I got a problem with the Google Api Php Client and Google Fit . I want to get the sum of steps I made in a day. I found a response but it doesn't work (look at the gist). My php code: // Retrive oauth data $clientData = json_decode(file_get_contents("../Devbook-87e2bafd84e6.json")); $client_email = $clientData->client_email; $private_key = $clientData->private_key; $scopes = array(Google_Service_Fitness::FITNESS_ACTIVITY_READ); $credentials = new Google_Auth_AssertionCredentials( $client

How to get the next 10,000 data from google analytics api using php?

戏子无情 提交于 2021-01-28 08:06:15
问题 Good day, Is there a way to get the next 10,000 data from google analytics API? I would want to get the next set of data after getting the first 10,000. Is there a way to accomplish that? I am using google analytics api php client libraries. Here is my code: <?php $analytics = initializeAnalytics(); $response = getReport($analytics); printResults($response); function initializeAnalytics() { $KEY_FILE_LOCATION = __DIR__ . 'MyFileDirectory'; // Create and configure a new client object. $client

Why google Calendar event not being created with stored access token and refresh token in php

瘦欲@ 提交于 2021-01-05 07:41:36
问题 I have successfully integrated google OAuth 2.0 with Calendar permissions and I am storing access token and refresh token in the database, after that fetch both token. do not know what wrong I am doing the Calendar event not being created. <?php include($_SERVER["DOCUMENT_ROOT"]."/config.php"); include($_SERVER["DOCUMENT_ROOT"]."/functions.php"); require 'vendor/autoload.php'; function getClient($useremail) { $client = new Google_Client(); $client->setApplicationName('Google Calendar API PHP

Service account Domain-wide delegation - Google Calendar API v3 on PHP

冷暖自知 提交于 2021-01-01 06:55:06
问题 I have a problem with the domain-wide delegation using Google API PHP Client (https://github.com/googleapis/google-api-php-client). I know this question has been asked before but I couldn’t find any solution, so I’m here asking again hoping that meanwhile someone solved this problem. Situation I created a service account and enabled G Suite domain-wide delegation, following the google guide (https://developers.google.com/admin-sdk/directory/v1/guides/delegation), but I cannot read the

Invalid value (400) using google translate api

纵然是瞬间 提交于 2020-12-10 14:26:18
问题 What's wrong with my request? I have sting in russian: $string = Потенциал, % I want to translate it to ukrainian with google API: I urlencode string: $q = urlencode($string) And i request google API: https://www.googleapis.com/language/translate/v2?q=%D0%9F%D0%BE%D1%82%D0%B5%D0%BD%D1%86%D0%B8%D0%B0%D0%BB%2C%20%25&target=ua&source=ru&key=A... In response I get : { "error": { "errors": [ { "domain": "global", "reason": "invalid", "message": "Invalid Value" } ], "code": 400, "message": "Invalid