An object to interact with the Laserfiche Cloud OAuth 2.0 token endpoint.

interface ITokenClient {
    getAccessTokenFromCode(
        code: string,
        redirect_uri: string,
        client_id: string,
        client_secret?: string,
        code_verifier?: string,
        scope?: string,
    ): Promise<GetAccessTokenResponse>;
    getAccessTokenFromServicePrincipal(
        servicePrincipalKey: string,
        accessKey: AccessKey,
        scope?: string,
    ): Promise<GetAccessTokenResponse>;
    refreshAccessToken(
        refresh_token: string,
        client_id: string,
        client_secret?: string,
    ): Promise<GetAccessTokenResponse>;
}

Implemented by

Methods

  • Gets an OAuth access token given an OAuth code

    Parameters

    • code: string

      Authorization code

    • redirect_uri: string

      Authorization endpoint redirect uri

    • client_id: string

      OAuth application client id

    • Optionalclient_secret: string

      OPTIONAL OAuth application client secret. Required for web apps.

    • Optionalcode_verifier: string

      OPTIONAL PKCE code verifier. Required for SPA apps.

    • Optionalscope: string

      OPTIONAL The requested space-delimited scopes for the access token.

    Returns Promise<GetAccessTokenResponse>

  • Gets an OAuth access token given a Laserfiche cloud service principal key and an OAuth service application access key.

    Parameters

    • servicePrincipalKey: string

      Laserfiche cloud service principal key

    • accessKey: AccessKey

      OAuth service application access key

    • Optionalscope: string

      OPTIONAL The requested space-delimited scopes for the access token.

    Returns Promise<GetAccessTokenResponse>