AtCliff_
AtCliff_

Reputation: 173

Google OAuth authorisation of many people in one script

Good day! I have a small problem with Google OAuth. There is some application that needs to synchronize contacts from some database with Google Contacts. Accordingly, I have to authorize users in my application in Google Cloud People. So the question is how to cyclically authorize people to import contacts, what should I store for each user? I really hope you got what I meant. I'm using PHP Google API library.

Upvotes: 0

Views: 46

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116908

In order to access a users google contacts data you need their consent. When you authenticate each user you should request offline access then google will return to you a refresh token.

If you store the refresh token in your database you will be able to use that at anytime to request a new access token. With the access token you will be able to access the users data.

$client->fetchAccessTokenWithRefreshToken($refreshToken);

Upvotes: 2

Related Questions