File

src/auth/iam.ts

Index

Properties
Methods

Constructor

constructor(selector: string, token: string)

IAM credentials.

Parameters :
Name Type Optional Description
selector string No

the iam authority selector

token string No

the token

Properties

Public selector
Type : string
the iam authority selector
Public token
Type : string
the token

Methods

getRequestHeaders
getRequestHeaders()

Acquire the HTTP headers required to make an authenticated request.

export interface RequestMetadata {
  'x-goog-iam-authority-selector': string;
  'x-goog-iam-authorization-token': string;
}

export class IAMAuth {
  /**
   * IAM credentials.
   *
   * @param selector the iam authority selector
   * @param token the token
   * @constructor
   */
  constructor(public selector: string, public token: string) {
    this.selector = selector;
    this.token = token;
  }

  /**
   * Acquire the HTTP headers required to make an authenticated request.
   */
  getRequestHeaders() {
    return {
      'x-goog-iam-authority-selector': this.selector,
      'x-goog-iam-authorization-token': this.token,
    };
  }
}

result-matching ""

    No results matching ""