node google client api to get user profile with already fetched token

Solutions on MaxInterview for node google client api to get user profile with already fetched token by the best coders in the world

showing results for - "node google client api to get user profile with already fetched token"
Myfanwy
07 Jan 2017
1var google = require('googleapis').google;
2var OAuth2 = google.auth.OAuth2;
3var oauth2Client = new OAuth2();
4oauth2Client.setCredentials({access_token: 'ACCESS TOKEN HERE'});
5var oauth2 = google.oauth2({
6  auth: oauth2Client,
7  version: 'v2'
8});
9oauth2.userinfo.get(
10  function(err, res) {
11    if (err) {
12       console.log(err);
13    } else {
14       console.log(res);
15    }
16});
17