anuj607 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

if i already have a access_token, how to use the api to get data? #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to connect google login to my site, if i already have a access_token, 
how to use the api to get data?

Original issue reported on code.google.com by chengen....@gmail.com on 28 Mar 2012 at 4:33

GoogleCodeExporter commented 9 years ago
You can use $client->setAccessToken($token) to set your own access token, where 
$token is a json encoded string in the following format.

$token = json_encode(array('access_token' => 'insert-your-access-token-here', 
'refresh_token' => 'your-refresh-token-here'));
$client->setAccessToken($token);

From this point, you can make api calls. A good example is provided here:
http://code.google.com/p/google-plus-php-starter/

Original comment by chirags@google.com on 29 Mar 2012 at 8:31