Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • GoogleToken

Index

Constructors

  • Create a GoogleToken.

    Parameters

    Returns GoogleToken

Properties

additionalClaims?: {}

Type declaration

    eagerRefreshThresholdMillis?: number
    email?: string
    expiresAt?: number
    iss?: string
    key?: string
    keyFile?: string
    rawToken?: TokenData
    scope?: string
    sub?: string
    tokenExpires?: number
    transporter: Transporter

    Accessors

    • get accessToken(): undefined | string
    • Returns undefined | string

    • get idToken(): undefined | string
    • Returns undefined | string

    • get refreshToken(): undefined | string
    • Returns undefined | string

    • get tokenType(): undefined | string
    • Returns undefined | string

    Methods

    • Given a keyFile, extract the key and client email if available

      Parameters

      • keyFile: string

        Path to a json, pem, or p12 file that contains the key.

      Returns Promise<Credentials>

      an object with privateKey and clientEmail properties

    • Returns a cached token or retrieves a new one from Google.

      Parameters

      Returns Promise<TokenData>

    • Parameters

      Returns void

    • hasExpired(): boolean
    • Returns whether the token has expired.

      Returns boolean

      true if the token has expired, false otherwise.

    • isTokenExpiring(): boolean
    • Returns whether the token will expire within eagerRefreshThresholdMillis

      Returns boolean

      true if the token will be expired within eagerRefreshThresholdMillis, false otherwise.

    • revokeToken(): Promise<void>
    • revokeToken(callback: (err?: Error) => void): void
    • Revoke the token if one is set.

      Returns Promise<void>

    • Parameters

      • callback: (err?: Error) => void
          • (err?: Error): void
          • Parameters

            • Optional err: Error

            Returns void

      Returns void