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
.
Asked
Active
Viewed 42 times
0

AtCliff_
- 173
- 8
1 Answers
2
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);

Linda Lawton - DaImTo
- 106,405
- 32
- 180
- 449
-
I'm logged in into my application with two different accounts, two different PCs and got two different refresh tokens. But somehow all contacts which are supposed to be synchronized with the second acc got right into first's acc contacts. – AtCliff_ Aug 08 '18 at 10:21
-
Sorry, my fault, didn't make new class for each token. Thanks a lot! – AtCliff_ Aug 08 '18 at 10:39