docs: async function authenticate(options) {
      const tokenFile = path.join(constants.GLOBAL_DIR, constants.GLOBAL_TOKEN);
      const configFile = path.join(constants.GLOBAL_DIR, constants.GLOBAL_CONFIG);
  
      // Ensure a config file exists
      if (!fs.pathExistsSync(configFile)) {
          createFile({
              name: configFile,
              source: `{}\n`,
          });
      }
  
      // Remove the token file if we are forcing reauth
      if (options.force) {
          fs.removeSync(tokenFile);
      }
  
      // get Oauth client
      const oauth2ClientResult = await getAuthClient();
      const oauth2Client = oauth2ClientResult.client;
      const isCustomClient = oauth2ClientResult.custom;
      let newOauth2Client;
  
      // Check if we have previously stored a token.
      let token;
      try {
          token = fs.readFileSync(tokenFile, 'utf8');
      } catch (err) {
          newOauth2Client = await getNewToken(oauth2Client, isCustomClient, options);
          await firebase.setUserInfo(newOauth2Client);
          return newOauth2Client;
      }
  
      // If we can find the token, refresh it, get a new one or do nothing
      const tokenObject = JSON.parse(token);
      oauth2Client.credentials = tokenObject;
      const ttl = oauth2Client.credentials.expiry_date - Date.now();
  
      if (ttl < 10 * 1000 || options.refresh) {
          try {
              newOauth2Client = await getToken(null, token, oauth2Client, isCustomClient);
              await firebase.setUserInfo(newOauth2Client);
              return newOauth2Client;
          } catch (err) {
              newOauth2Client = await getNewToken(oauth2Client, isCustomClient, options);
              await firebase.setUserInfo(newOauth2Client);
              return newOauth2Client;
          }
      } else {
          return oauth2Client;
      }
  }