Git Product home page Git Product logo

php-google-people-api's Introduction

👥 PHP Google People API

This package provides a user friendly way of interacting with Google Contacts via the Google People API.

Installation

PHP Google People API can be easily installed using Composer. Just run the following command from the root of your project.

composer require rapidwebltd/php-google-people-api

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.

Setup

To use this package, you need to authenticate with Google via OAuth 2. Thankfully, this is made easy by the PHP Google OAuth 2 Handler package.

You can run its guided setup script with the following command.

php vendor/rapidwebltd/php-google-oauth-2-handler/src/setup.php

This will guide you through the process of setting up a project, and logging into to the Google account that you wish to manage contacts for. When asked which scopes you require access to, enter the following.

https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/contacts
https://www.googleapis.com/auth/contacts.readonly

When complete, you will have to code you need to create a GoogleOAuth2Handler object for this Google account.

You can then create a GooglePeople object, as follows.

$people = new GooglePeople($googleOAuth2Handler);

Usage

Retrieve all contacts

// Retrieval all contacts
foreach($people->all() as $contact) {
    echo $contact->resourceName.' - ';
    if ($contact->names) {
        echo $contact->names[0]->displayName;
    }
    echo PHP_EOL;
}

Retrieve a single contact

// Retrieve single contact (by resource name)
$contact = $people->get('people/c8055020007701654287');

Create a new contact

// Create new contact
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = 'Testy';
$contact->names[0]->familyName = 'McTest Test';
$contact->save();

Update a contact

// Update contact
$contact->names[0]->familyName = 'McTest';
$contact->save();

Delete a contact

// Delete contact
$contact->delete();

php-google-people-api's People

Contributors

divineomega avatar juniyadi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-google-people-api's Issues

php-google-people-api laravel 11 installation failed

php-google-people-api installation failed in laravel 11 ,dependencies happen to conflict :

after running composer require php-google-people-api I get the following terminal output

./composer.json has been updated
Running composer update rapidwebltd/php-google-people-api --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - rapidwebltd/php-google-oauth-2-handler[v1.2.1, ..., v1.2.2] require guzzlehttp/guzzle ^6.3 -> found guzzlehttp/guzzle[6.3.0, ..., 6.5.8] but it conflicts with your root composer.json require (^7.8).
    - rapidwebltd/php-google-people-api[v1.0.0, ..., v1.0.1] require rapidwebltd/php-google-oauth-2-handler ^1.2.1 -> satisfiable by rapidwebltd/php-google-oauth-2-handler[v1.2.1, v1.2.2].
    - Root composer.json requires rapidwebltd/php-google-people-api * -> satisfiable by rapidwebltd/php-google-people-api[v1.0.0, v1.0.1].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require rapidwebltd/php-google-people-api:*" to figure out if any version is installable, or "composer require rapidwebltd/php-google-people-api:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content. ```

$people->all () not getting all

When I first started using this project I thought that $people->all() was getting all my contacts (might be wong). As of resent it is not finding some contacts that it use to. From what I can see, it is not finding really old contacts, created a decade or more.

If I go to my Google Contacts and do a change, then suddenly my what use to be not found contact is now found again by $people->all ().

I am getting an error code related to authorization could help me in this

all() as $contact) { echo $contact->resourceName.' - '; if ($contact->names) { echo $contact->names[0]->displayName; } echo PHP_EOL; } ?>

Here is the error i am getting

Fatal error: Uncaught exception 'Exception' with message '{ "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } } ' in /home/newrsczn/public_html/ragtime.media/ADMIN/google/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php:63 Stack trace: #0 /home/newrsczn/public_html/ragtime.media/ADMIN/google/contact.php(27): RapidWeb\GooglePeopleAPI\GooglePeople->all() #1 {main} thrown in /home/newrsczn/public_html/ragtime.media/ADMIN/google/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php on line 63


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Problem adding new Contact

Hello!

I wrote a script where Retrieving and Updating Contacts is working perfect.
The only thing I'm not able to do, is adding a new contact.

I am using it this way as shown in your documentation:
// Create new contact
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = 'Testy';
$contact->names[0]->familyName = 'McTest Test';
$contact->save();

The error message is always the following:

Fatal error: Uncaught Error: Class 'Contact' not found in /var/www/html/googlecontacts/google-contacts.php:34 Stack trace: #0 {main} thrown in /var/www/html/googlecontacts/google-contacts.php on line 34

I have added the script.

Thank you very much for your help!
Arno.

google-contacts.txt


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

I can't get client ID and client secret

When i follow the link i get this form:
The last two options i don't know what to choose.
I think

Captura de Pantalla 2020-07-29 a la(s) 22 16 01

i think it would be like this

Captura de Pantalla 2020-07-29 a la(s) 22 17 53

Here i Selected this and a Json file is downloaded is it ok?

Captura de Pantalla 2020-07-29 a la(s) 22 21 36

I have Client id on the file but i have'nt Google Client Secret. Is one of this the client secret?

Captura de Pantalla 2020-07-29 a la(s) 22 24 48

Thanks a lot


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Fatal error: Uncaught Error: Class 'GoogleOAuth2Handler' not found i

Hello
I'm having error in load the library GoogleOAuth2Handler, Somebody Help me?

`require DIR . '/vendor/autoload.php';

$clientId = '#;
$clientSecret = '#';
$refreshToken = '#';
$scopes = ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/contacts', 'https://www.googleapis.com/auth/contacts.readonly'];

$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);

$people = new GooglePeople($googleOAuth2Handler);

$contacts = $people->all();

print_r($contacts);`

Fatal error: Uncaught Error: Class 'GoogleOAuth2Handler' not found in /Applications/MAMP/htdocs/googlecontact/index.php:11 Stack trace: #0 {main} thrown

SO = IOS
PHP = 7.1.2
MAMP


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

New Contact with Phone and Email

I am getting no errors like this, contact with name will save, but phone number will not save. Trying to add a new contact with name, phone number, and email.
This is what I got:
require_once DIR . '/vendor/autoload.php';

use RapidWeb\GooglePeopleAPI\GooglePeople;
use RapidWeb\GooglePeopleAPI\Contact;
use RapidWeb\GoogleOAuth2Handler\GoogleOAuth2Handler;
$clientId     = '-.apps.googleusercontent.com';
$clientSecret = '-';
$refreshToken = '-';
$scopes       = ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/contacts', 'https://www.googleapis.com/auth/contacts.readonly'];

$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);
$people = new GooglePeople($googleOAuth2Handler);

// Create new contact
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = 'T ';
$contact->names[0]->familyName = 'McTest Test';
$contact->phoneNumber[0] = new stdClass;
$contact->phoneNumber[0]->phoneNumber ='07812363789';
$contact->save()

show error on $connections

foreach ($people->all() as $contact) { // echo $contact->resourceName . ' - '; if ($contact->names) { echo $contact->names[0]->displayName . "\n"; $contact->delete(); } // echo PHP_EOL; }

when $people is null thats show error like this
Warning: Undefined property: stdClass::$connections in C:\xampp\htdocs\phpto\vendor\rapidwebltd\php-google-people-api\src\GooglePeople.php on line 70
PHP Warning: foreach() argument must be of type array|object, null given in C:\xampp\htdocs\phpto\vendor\rapidwebltd\php-google-people-api\src\GooglePeople.php on line 70

$people->all() does not give me all contacts

I have a Google account with 4704 contacts (according to the Google Contacts app). When looping through $people->all() I get only 4608 contacts. When I try to retrieve some of the missing contacts with $people->get($resourceName) the contacts do turn up (I can get the resourceName of a missing contact manually by inspecting the popup window on the Google Contacts page).

What is wrong? Why don't my 100 or so missing contacts show up?

Request is missing required authentication credential

I am using this api to store new contacts in every new register in my application

So, using laravel, I created a Job to do this for me:

$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);

$people = new GooglePeople($googleOAuth2Handler);

$name = explode(' ', $this->data['name']);

$contact = new Contact($people);
$contact->names[0] = new \stdClass();
$contact->names[0]->givenName = $name[0];
$contact->names[0]->familyName = count($name) > 1 ? $name[1] : ' ';
$contact->phoneNumbers[0] = new \stdClass();
$contact->phoneNumbers[0]->value = $this->data['entity_phone'];
$contact->save();

This was working until last month, but now I am receiving this error every single time I try to register a new contact:

"error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED"
  }

I already tried create a new refresh token, but still got the same error message. Someone know what can I do to fix this?

Service Account

Im using a ServiceAccount with a json file. I do not need to authenticate with Google via OAuth 2. Is it possible to include only the class instead of all? Like this:
$client = new Google_Client();
$client->setApplicationName("...");
$client->setScopes(array('https://www.googleapis.com/auth/contacts', 'https://www.googleapis.com/auth/contacts.readonly'));
if ($credentials_file = checkServiceAccountCredentialsFile()) {
$client->setAuthConfig($credentials_file);
} elseif (getenv('GOOGLE_APPLICATION_CREDENTIALS')) {
$client->useApplicationDefaultCredentials();
} else {
echo missingServiceAccountDetailsWarning();
return;
}
$people_service = new Google_Service_PeopleService($client);


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Fatal error: Uncaught Error: Class 'GooglePeople' ... Stack trace: #0 {main} thrown in

My php file show the next error:
Fatal error: Uncaught Error: Class 'GooglePeople' not found in /var/www/html/gcontacts/index.php:5 Stack trace: #0 {main} thrown in /var/www/html/gcontacts/index.php on line 5

index.php code:
require_once __DIR__ . '/vendor/autoload.php'; $people = new GooglePeople($GoogleOAuth2Handler);

php.ini display_errors are On

I do some wrong, please help!

Setup.php PHP Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate

Executing the setup.php when i obtain the auth code, once i paste in the shell, it returns me the following error:

PHP Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:201
Stack trace:
#0 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(155): GuzzleHttp\Handler\CurlFactory::createRejection()
#1 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(105): GuzzleHttp\Handler\CurlFactory::finishError()
#2 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish()
#3 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#4 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#5 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(66): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#6 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Middleware.php(29): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#7 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(70): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#8 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Middleware.php(57): GuzzleHttp\RedirectMiddleware->__invoke()
#9 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\HandlerStack.php(71): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#10 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Client.php(351): GuzzleHttp\HandlerStack->__invoke()
#11 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Client.php(112): GuzzleHttp\Client->transfer()
#12 C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Client.php(129): GuzzleHttp\Client->sendAsync()
#13 C:\Users\renti\Desktop\API-GOOGLE\vendor\google\auth\src\HttpHandler\Guzzle6HttpHandler.php(47): GuzzleHttp\Client->send()
#14 C:\Users\renti\Desktop\API-GOOGLE\vendor\google\auth\src\OAuth2.php(535): Google\Auth\HttpHandler\Guzzle6HttpHandler->__invoke()
#15 C:\Users\renti\Desktop\API-GOOGLE\vendor\google\apiclient\src\Client.php(247): Google\Auth\OAuth2->fetchAuthToken()
#16 C:\Users\renti\Desktop\API-GOOGLE\vendor\google\apiclient\src\Client.php(226): Google\Client->fetchAccessTokenWithAuthCode()
#17 C:\Users\renti\Desktop\API-GOOGLE\vendor\rapidwebltd\php-google-oauth-2-handler\src\GoogleOAuth2Handler.php(50): Google\Client->authenticate()
#18 C:\Users\renti\Desktop\API-GOOGLE\vendor\rapidwebltd\php-google-oauth-2-handler\src\setup.php(65): RapidWeb\GoogleOAuth2Handler\GoogleOAuth2Handler->getRefreshToken()
#19 {main}
thrown in C:\Users\renti\Desktop\API-GOOGLE\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 201

Notes: My account is set as TV and limited entry, and im in testing, not production, but i have set a testing account.

Thanks in advance

Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\Sacco1\process\login.php:22 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Sacco1\process\login.php on line 22

hi am trying to log in with my credentials and am geting this error.

Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\Sacco1\process\login.php:22 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Sacco1\process\login.php on line 22

and this is the code
$uname = mysql_real_escape_string($uname);
$upass = mysql_real_escape_string($upass);
$upass = md5($upass);
$sql = "SELECT * FROM users WHERE uname ='$uname' AND upassword ='$upass'";
$user = $driver->perform_request($sql) or $error='SQL ERROR '.mysql_error().'';
if(mysql_num_rows($user)>1)

is the code correct? or why is it not getting information from the database?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

they could consider this function to validate the status of a contact.

when executing this function we will obtain the status of the contact when opting its data or editing the contact data.

  • Consider this function or improve that function.

$people->getStatusCode('people/c0000000000000000');

public function getStatusCode($resourceName) { $url = self::PEOPLE_BASE_URL.$resourceName.'?personFields='.implode(',', self::PERSON_FIELDS); $response = $this->googleOAuth2Handler->performRequest('GET', $url); return $response->getStatusCode(); }

  • I hope I have been helpful.

Add photo to new contact

Hello,

I'm trying to add a photo to a new contact. That's my try:

function createContact(string $givenName, string $familyName, string $nickName) {
    $contact = new Contact($this->people);
    
    $contact->names[0] = new stdClass;
    $contact->names[0]->givenName = $givenName;
    $contact->names[0]->familyName = $familyName;
    
    $contact->nicknames[0] = new stdClass;
    $contact->nicknames[0]->value = $nickName;
    
    $contact->phoneNumbers[0] = new stdClass;
    $contact->phoneNumbers[0]->value = '0123456789';
   
    $contact->photos[0] = new stdClass;
    $contact->photos[0]->url = 'my private url';
    $contact->photos[0]->default = true; // I tried also false
    // no error, no photo
    
    $contact->save();
}

I have a new contact in Google Contacts but I can't see a photo. What I have to do? I'm looking forward for your advice. Thanks.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Contact Group Membership

Hi! I am trying to add the Membership Group, and I cannot find the correct way to assign the Group to the contact. I have read some documentation that only is needed this part: https://developers.google.com/people/api/rest/v1/people#Person.ContactGroupMembership

So, I have added in the array this:
$contact->memberships[0]->contactGroupMembership->contactGroupResourceName = 'contactGroups/{GROUP_ID};

But, this is not taking the group. It saved all the data, but not the group.

Please let me know how to solve this.

Thanks.

Resource has been exhausted

Hello! Somebody can help me?

When I save a user in my application, the user should be saved in Google Contacts. But it has this error:

{"error":{"code":429, "message": "Resource has been exhausted (e.g. check quota).", "status": "RESOURCE_EXHAUSTED", "details":[{"@type":"type.googleapis.com/google.rpc.QuotaFailure", "violations": [{"subject": "QUOTA_EXCEEDED", "description": "FBS quota limit exceeded"}]}]}}

New contact has stopped working

Yesterday, creating a new contact with the error suddenly stopped working:
PHP Fatal error: Uncaught exception 'Exception' with message '{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \"parent\": Cannot bind query parameter. Field 'parent' could not be found in request message.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Invalid JSON payload received. Unknown name \"parent\": Cannot bind query parameter. Field 'parent' could not be found in request message." } ] } ] } } ' in /var/www/moduly/google/kontakty/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php:132 Stack trace: #0 /var/www/moduly/google/kontakty/vendor/rapidwebltd/php-google-people-api/src/Contact.php(16): RapidWeb\GooglePeopleAPI\GooglePeople->save(Object(RapidWeb\GooglePeopleAPI\Contact)) #1 /var/www/ttt.php(24): RapidWeb\GooglePeopleAPI\Contact->save() #2 {main} thrown in /var/www/moduly/google/kontakty/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php on line 132

However, updating the existing contract works!

Guzzle Version conflict

Hello
Thanks for your great package
I have issues installing the package on laravel 8, PHP8

--- Composer :
Your requirements could not be resolved to an installable set of packages.
Problem 1
- rapidwebltd/php-google-people-api[v1.0.0, ..., v1.0.1] require rapidwebltd/php-google-oauth-2-handler ^1.2.1 -> satisfiable by rapidwebltd/php-google-oauth-2-han
dler[v1.2.1, v1.2.2].
- rapidwebltd/php-google-oauth-2-handler[v1.2.1, ..., v1.2.2] require guzzlehttp/guzzle ^6.3 -> found guzzlehttp/guzzle[6.3.0, ..., 6.5.x-dev] but it conflicts wit
h your root composer.json require (^7.0.1).
- Root composer.json requires rapidwebltd/php-google-people-api ^1.0 -> satisfiable by rapidwebltd/php-google-people-api[v1.0.0, v1.0.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Please Help

Memberships

The whole Google API is a bit confusing in naming their properties.
What I would like to do is after adding a new Contact it would also have a predefined "Label" to it on the Google Contacts page.

What I gather is that the "Labels" are defined under the Contacts object memberships[] value?
People API says it's read-only and it's also not under the UPDATE_PERSON_FIELDS constant.

I found something called contactGroups but im not sure it's the right resource?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Error 400, redirect_uri_mismatch

Lads, thanks for this fantastic project. Its the first time I'm implementing a solution using OAuth2.

At this moment I receive an error which is:

The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type...

Using vendor/rapidwebltd/php-google-oauth-2-handler/src/setup.php, I created a login with a type of Webserver. Because my project is a PHP project. Within the steps I don't know what the redirect URI is and I think I'm missing the refresh token.

Is there a way you anyone can help me figuring this out? Searched the internet therefor, but I'm getting more confused.

error google uri

Thanks in Advance!

Increase token expiration time

Hello I notiche that the oauth token expiration time is too short...each month i need to relogin and give the authorization to refresh it. Is it possibile to increase the expiration time...if so where do I have to change the parameter?
Thank U

[request] Batch Create/Update Contact

Hi as mentions above, is it this package going to expend with extra feature?

i trying to sync my contact with this package, it getting extreamly slow and get block after some requset.

hope you are planing to add this feature.

[Question] Re $people->get()

Does $people->get('people/c...') require specific config in either Google API Console or in php?

Throws a 500 error on my system. $people->all() etc. work as expected.

out 400: redirect_uri_mismatch

I started to use this repository but struggeling with the google authentication.
I want use add and modify contacts from my php website.
Therefore I added a credential (type web application) as mentioned in the setup

When is do the setup "php vendor/rapidwebltd/php-google-oauth-2-handler/src/setup.php" i enter the credentials given by google and add the required scopes. The I receive from the set up a long webadres. I copy it and paste in my browser.
The I receive an error:

out 400: redirect_uri_mismatch
The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob,
can only be used by a Client ID for native application.
It is not allowed for the WEB client type.

This error is mentioned earlier in this forum, but the answer was to use type "other".
But this option is not available anymore.
Does anyone know how to exactly setup the google credentials?

Undefined variable: googleOAuth2Handler

I am trying to use this package in Laravel project.

I have imported this class
use RapidWeb\GooglePeopleAPI\GooglePeople;

When use this line in my code:

$client = new GooglePeople($googleOAuth2Handler);

When passing $googleOAuth2Handle I get an error of Undefined variable

php-google-oauth-2-handler problem - Error 400: invalid_request

Hi
We try to use your library install it by composer and run
vendor/rapidwebltd/php-google-oauth-2-handler/src/setup.php

We create oauth key 2.0 for desktop application, copy it in instalation wizard and on last step when we need to open link in browser Google return Error 400: invalid_request

You can’t sign in because {account name} sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error
If you are a developer of {account}, see error details.
Error 400: invalid_request

What we do wrong?
Thanks

OAuth oob flow will be deprecated

In a blog post earlier this year, Google announced that the "OAuth out-of-band (oob) flow will be deprecated" and will no longer work as of October 3, 2022. Will this package still work after that date?

Etag error message

Hi,

I retrieve a contact:
$p = $people->get($resourceName);
apply some changes
$p->names = [$values];
and try to save the contact:
$p->save();
This nearly always gets me the following error message:
Request person.metadata.sources.etag is different than the current person.metadata.sources.etag. Clear local cache and get the latest person

What can I do against that?

Fatal error: Uncaught Error: Class 'GoogleOAuth2Handler' not found

Sorry again,

require_once __DIR__ . '/vendor/autoload.php';

use RapidWeb\GooglePeopleAPI\GooglePeople;

$clientId     = '65blablablablablacbn.apps.googleusercontent.com';
$clientSecret = 'fcblablablablab4lX';
$refreshToken = '1/blablablablalbalblablbalbalbablabla2V';
$scopes       = ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/contacts', 'https://www.googleapis.com/auth/contacts.readonly'];

$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);

This php code show me that error:
Fatal error: Uncaught Error: Class 'GoogleOAuth2Handler' not found in ... Stack trace: #0 {main} thrown in

Invalid JSON payload received

Look like Google People Need Updates

PHP Fatal error:  Uncaught Exception: {
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"parent\": Cannot bind query parameter. Field 'parent' could not be found in request message.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"parent\": Cannot bind query parameter. Field 'parent' could not be found in request message."
          }
        ]
      }
    ]
  }
}
 in /var/www/html/php-google-people/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php:132
Stack trace:
#0 /var/www/html/php-google-people/vendor/rapidwebltd/php-google-people-api/src/Contact.php(16): RapidWeb\GooglePeopleAPI\GooglePeople->save(Object(RapidWeb\GooglePeopleAPI\Contact))
#1 /var/www/html/php-google-people/save.php(18): RapidWeb\GooglePeopleAPI\Contact->save()
#2 {main}
  thrown in /var/www/html/php-google-people/vendor/rapidwebltd/php-google-people-api/src/GooglePeople.php on line 132

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.