Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LwaServiceClient

Class to be used to call Amazon LWA to retrieve access tokens.

Hierarchy

Index

Constructors

constructor

Properties

Protected apiConfiguration

apiConfiguration: ApiConfiguration

ApiConfiguration instance to provide dependencies for this service client

Protected authenticationConfiguration

authenticationConfiguration: AuthenticationConfiguration

Protected grantType

grantType: string

Protected tokenStore

tokenStore: object

Type declaration

Static Protected AUTH_ENDPOINT

AUTH_ENDPOINT: string = "https://api.amazon.com"

Static Protected CLIENT_CREDENTIALS_GRANT_TYPE

CLIENT_CREDENTIALS_GRANT_TYPE: string = "client_credentials"

Static Protected EXPIRY_OFFSET_MILLIS

EXPIRY_OFFSET_MILLIS: number = 60000

Static Protected LWA_CREDENTIALS_GRANT_TYPE

LWA_CREDENTIALS_GRANT_TYPE: string = "refresh_token"

Static Protected REFRESH_ACCESS_TOKEN

REFRESH_ACCESS_TOKEN: string = "refresh_access_token"

Methods

Protected generateAccessToken

getAccessToken

  • getAccessToken(scope?: string): Promise<string>
  • Parameters

    • Optional scope: string

    Returns Promise<string>

getAccessTokenForScope

  • getAccessTokenForScope(scope: string): Promise<string>
  • Parameters

    • scope: string

    Returns Promise<string>

Protected invoke

  • invoke(method: string, endpoint: string, path: string, pathParams: Map<string, string>, queryParams: Array<object>, headerParams: Array<object>, bodyParam: any, errors: Map<number, string>, nonJsonBody?: boolean): Promise<any>
  • Invocation wrapper to implement service operations in generated classes

    Parameters

    • method: string

      HTTP method, such as 'POST', 'GET', 'DELETE', etc.

    • endpoint: string

      base API url

    • path: string

      the path pattern with possible placeholders for path parameters in form {paramName}

    • pathParams: Map<string, string>

      path parameters collection

    • queryParams: Array<object>

      query parameters collection

    • headerParams: Array<object>

      headers collection

    • bodyParam: any

      if body parameter is present it is provided here, otherwise null or undefined

    • errors: Map<number, string>

      maps recognized status codes to messages

    • Optional nonJsonBody: boolean

      if the body is in JSON format

    Returns Promise<any>

withRequestInterceptors

  • withRequestInterceptors(...requestInterceptors: Array<function>): BaseServiceClient

withResponseInterceptors

  • withResponseInterceptors(...responseInterceptors: Array<function>): BaseServiceClient