async function authorize(credentials, callback, docID) {
    const { client_secret, client_id, redirect_uris } = credentials.installed;
    const oAuth2Client = new google.auth.OAuth2(
      client_id, client_secret, redirect_uris[0]);


    let docData = null;
    // parse token if it exists.
    const token = await fs.readFileSync(TOKEN_PATH);
    let tokenJSON = JSON.parse(token);
    if (tokenJSON === undefined) {
      docData = getNewToken(oAuth2Client, callback, docID);
    } else {
      tokenJSON.access_token = process.env.GOOGLE_ACCESS_TOKEN;
      tokenJSON.refresh_token = process.env.GOOGLE_REFRESH_TOKEN;
      oAuth2Client.setCredentials(tokenJSON);
      docData = await callback(oAuth2Client,docID);
    }
    return docData;
  }
/**
   * Create an OAuth2 client with the given credentials, and then execute the
   * given callback function.
   * @param {Object} credentials The authorization client credentials.
   * @param {function} callback The callback to call with the authorized client.
   */
Create an OAuth2 client with the given credentials, and then execute the
given callback function.
@param {Object} credentials The authorization client credentials.
@param {function} callback The callback to call with the authorized client.
Create an OAuth2 client with the given credentials and then execute the given callback function . @param { Object } credentials The authorization client credentials . @param { function } callback The callback to call with the authorized client .
async function authorize(credentials, callback, docID) {
    const { client_secret, client_id, redirect_uris } = credentials.installed;
    const oAuth2Client = new google.auth.OAuth2(
      client_id, client_secret, redirect_uris[0]);
    let docData = null;
    const token = await fs.readFileSync(TOKEN_PATH);
    let tokenJSON = JSON.parse(token);
    if (tokenJSON === undefined) {
      docData = getNewToken(oAuth2Client, callback, docID);
    } else {
      tokenJSON.access_token = process.env.GOOGLE_ACCESS_TOKEN;
      tokenJSON.refresh_token = process.env.GOOGLE_REFRESH_TOKEN;
      oAuth2Client.setCredentials(tokenJSON);
      docData = await callback(oAuth2Client,docID);
    }
    return docData;
  }
async function authorize ( credentials , callback , docID ) { const { client_secret , client_id , redirect_uris } = credentials . installed ; const oAuth2Client = new google . auth . OAuth2 ( client_id , client_secret , redirect_uris [ 0 ] ) ; let docData = null ; const token = await fs . readFileSync ( TOKEN_PATH ) ; let tokenJSON = JSON . parse ( token ) ; if ( tokenJSON === undefined ) { docData = getNewToken ( oAuth2Client , callback , docID ) ; } else { tokenJSON . access_token = process . env . GOOGLE_ACCESS_TOKEN ; tokenJSON . refresh_token = process . env . GOOGLE_REFRESH_TOKEN ; oAuth2Client . setCredentials ( tokenJSON ) ; docData = await callback ( oAuth2Client , docID ) ; } return docData ; }
Create an OAuth2 client with the given credentials, and then execute the
 given callback function.
Create an OAuth2 client with the given credentials and then execute the given callback function .
// parse token if it exists.