Google OAuth authorisation of many people in one script

57 views Asked by At

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.

1

There are 1 answers

2
Linda Lawton - DaImTo On BEST ANSWER

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);