Reputation: 476
After login from client side and receive access token on the server side, I want to call Google API for taking info. Can I in server-side just call google API, without insert API key and another credential but only with the access token?
Something like that:
plus.people.get({
resourceName: 'people/me',
personFields: 'emailAddresses,names',
auth: accessToken}, (err, response) => {
console.log(response);
});
I'm actually using node.js
Upvotes: 0
Views: 1474
Reputation: 201378
I understood that you want to use people.get using access token. If my understanding is correct, how about this sample script?
var google = require('googleapis');
var plus = google.people('v1');
var OAuth2 = google.auth.OAuth2;
var oauth2Client = new OAuth2();
oauth2Client.setCredentials({access_token: accessToken});
plus.people.get({
resourceName: 'people/me',
personFields: 'emailAddresses,names',
auth: oauth2Client}, (err, response) => {
console.log(response);
});
If I misunderstand your question, I'm sorry.
Upvotes: 4