How to use the googleapis.options function in googleapis

To help you get started, we’ve selected a few googleapis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dandelany / animate-earth / pipeline / youtube.js View on Github external
function authenticateYoutube(credentials, tokenPath, callback) {
    const {client_id, client_secret, redirect_uris} = credentials.web;
    const oauth2Client = new OAuth2(client_id, client_secret, redirect_uris[0]);
    Google.options({auth: oauth2Client});

    if(fileExists(tokenPath)) {
        console.log('youtube token already exists');
        const tokens = JSON.parse(sh.cat(tokenPath));
        oauth2Client.setCredentials(tokens);
        // get playlists to check if token is really valid or not
        listPlaylists((err, data) => {
            if(err) {
                console.log('youtube token invalid, getting a new one');
                getYoutubeTokens(oauth2Client, tokenPath, callback);
            } else {
                console.log('youtube token is still valid');
                callback(oauth2Client);
            }
        }, {part: 'id'});
    } else {
github pubpub / pubpub / api / routes / analytics-routes.js View on Github external
jwtClient.authorize(function(err, tokens) {
	if (err) {
		console.info('Ganalytics JWT error ', err);
		return err;
	}
	oauth2Client.setCredentials({access_token: tokens.access_token});
	google.options({ auth: oauth2Client });
	ganalytics = google.analyticsreporting('v4');
	// return ganalytics;
});
github prescottprue / fireadmin / functions / src / utils / serviceAccounts.js View on Github external
jwtClient.authorize(err => {
      if (!err) {
        google.options({ auth: jwtClient })
        resolve(jwtClient)
      } else {
        console.error(
          'Error authorizing with Service Account',
          err.message || err
        )
        reject(err)
      }
    })
  })
github artsmia / lume / server / src / gdrive / index.js View on Github external
},
      file
    } = req


    const {identities} = await getUser(userId)

    const {access_token} = identities.find(
      identity => identity.provider === 'google-oauth2'
    )

    auth.setCredentials({
      access_token,
    })

    google.options({auth})


    console.log("looking for directory")

    let {files} = await driveSearch({
      q: `mimeType='${gDirectory}' and name='Knight Images' and appProperties has {key='knight' and value='true'}`,
      fields: 'files(id, name, appProperties, permissions)'
    })

    let knightDirectoryId


    if (files.length < 1) {
       let {id} = await driveCreate({
        resource: {
          name: 'Knight Images',
github microsoft / google-play-vsts-extension / Tasks / google-play-rollout-update / google-play-rollout-update.js View on Github external
function updateGlobalParams(paramName, value) {
    tl.debug("Updating Global Parameters");
    tl.debug("SETTING " + paramName + " TO " + JSON.stringify(value));
    globalParams.params[paramName] = value;
    google.options(globalParams);
    tl.debug("Global Params set to " + JSON.stringify(globalParams));
}
github microsoft / google-play-vsts-extension / Tasks / vso-task-google-play / GooglePlay.js View on Github external
function updateGlobalParams(paramName, value) {
    tl.debug("Updating Global Parameters");
    tl.debug("SETTING " + paramName + " TO " + JSON.stringify(value));
    globalParams.params[paramName] = value;
    google.options(globalParams);
    tl.debug("Global Params set to " + JSON.stringify(globalParams));
}
github omriiluz / gdrive-sync / gsync.js View on Github external
function discoverGAPI(callback){
  auth = new googleapis.auth.OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
  auth.credentials=tokens;
  googleapis.options({auth: auth});
  drive = googleapis.drive('v2')
  callback();
}
github microsoft / google-play-vsts-extension / Tasks / google-play-promote / google-play-promote.js View on Github external
function updateGlobalParams(paramName, value) {
    tl.debug("Updating Global Parameters");
    tl.debug("SETTING " + paramName + " TO " + JSON.stringify(value));
    globalParams.params[paramName] = value;
    google.options(globalParams);
    tl.debug("Global Params set to " + JSON.stringify(globalParams));
}