Astrada TypeScript SDK
    Preparing search index...

    Class Configuration

    Index
    • get accessToken(): (name?: string, scopes?: string[]) => Promise<string>

      Returns the Authorization header value, requesting a token when none is cached.

      Returns (name?: string, scopes?: string[]) => Promise<string>

    • get basePathIsSandbox(): boolean

      True when basePath was given and marked as a sandbox stand-in.

      Returns boolean

    • get environment(): "production" | "sandbox"

      Returns "production" | "sandbox"

    • get fetchApi(): {
          (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
          (input: string | Request | URL, init?: RequestInit): Promise<Response>;
      }

      Returns {
          (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
          (input: string | Request | URL, init?: RequestInit): Promise<Response>;
      }

        • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optionalinit: RequestInit

          Returns Promise<Response>

        • (input: string | Request | URL, init?: RequestInit): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optionalinit: RequestInit

          Returns Promise<Response>

    • get logsIn(): boolean

      True when the SDK logs in itself (no accessToken was given).

      Returns boolean

    • Forgets the cached token, so the next call logs in again. With refused (the Authorization header the API refused), only that token is forgotten: a newer token, or a login already in flight, is kept, so concurrent 401s on one stale token cause one new login.

      Parameters

      • Optionalrefused: string

      Returns void

    • A short-lived token for the Unified Enrollment SDK v2 in the browser (its getAccessToken option): your backend calls this and returns the token to the page as plain text, with no Bearer in front.

      It is minted with your SDK client: the separate client id and secret Astrada gives you for the browser. The token carries every scope that SDK client holds (the login does not narrow a token on request), so that client must hold only the scopes the browser SDK needs. Never this configuration's own credentials: their token would carry every backend scope, so this configuration's clientId is refused (RangeError) unless it calls the sandbox API (a sandbox self sign-up gives one client for both). With allowedScopes, it throws instead of returning a token that carries any other scope. The token reaches every subaccount of your account, so check on your server that the user may use the subaccountId the page opens. Each call mints a new token (tokens last 5 minutes).

      Parameters

      • sdkClient: { allowedScopes?: readonly string[]; clientId: string; clientSecret: string }

      Returns Promise<string>

      RangeError for a missing or empty clientId or clientSecret; this configuration's own client when it does not call the sandbox API; a configuration made with accessToken (no account to log in to); allowedScopes that is not an array

      UnexpectedScopesError when the token carries a scope outside allowedScopes, or the login did not state its scopes (the check relies on the login's scope field)

      AuthenticationError when the token endpoint refuses the SDK client