async function getAccessTokenFromImpersonatedCredentials() {
    const googleAuth = new GoogleAuth({
      scopes: scope,
    });
    // Construct the GoogleCredentials object which obtains the default configuration from your
    // working environment.
    const {credential} = await googleAuth.getApplicationDefault();

    // delegates: The chained list of delegates required to grant the final accessToken.
    // For more information, see:
    // https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-permissions
    // Delegate is NOT USED here.
    const delegates = [];

    // Create the impersonated credential.
    const impersonatedCredentials = new Impersonated({
      sourceClient: credential,
      delegates,
      targetPrincipal: impersonatedServiceAccount,
      targetScopes: [scope],
      lifetime: 300,
    });

    // Get the OAuth2 token.
    // Once you've obtained the OAuth2 token, you can use it to make an authenticated call
    // to the target audience.
    const resp = await impersonatedCredentials.getAccessToken();
    // Token is in resp.token.
    console.log('Generated OAuth2 token with length %s', resp.token.length);
  }
TODO(developer):
 Uncomment and replace these variables before running the sample.