import type { Auth0ClientOptions } from '@auth0/auth0-spa-js'; import { Token } from '@xh/hoist/security/Token'; import { AccessTokenSpec, TokenMap } from '../Types'; import { BaseOAuthClient, BaseOAuthClientConfig } from '../BaseOAuthClient'; /** * Configuration for an {@link AuthZeroClient} - the Auth0 OAuth client. * Extends {@link BaseOAuthClientConfig} with Auth0-specific options. * * @see AuthZeroClient */ export interface AuthZeroClientConfig extends BaseOAuthClientConfig { /** Domain of your app registered with Auth0. */ domain: string; /** * Audience to pass to interactive login and ID token requests. * * If you are also requesting an *access* token for a single audience, pass that value here to * ensure that the initial login/token request returns a ready-to-use access token (and refresh * token) with a single request to the Auth0 API, instead of requiring two. * * This also avoids issues with browsers that block third party cookies when running on * localhost or with an Auth0 domain that does not match the app's own domain. In those cases, * Auth0 must use refresh tokens to obtain access tokens, and a single audience allows that * exchange to work without extra user interaction that this class does not currently support. */ audience?: string; /** * Additional options for the Auth0Client ctor. Will be deep merged with defaults, with options * supplied here taking precedence. Use with care, as overriding defaults may have unintended * consequences or fail to work with Hoist's expected usage of the client library. */ authZeroClientOptions?: Partial; } export interface AuthZeroTokenSpec extends AccessTokenSpec { /** * Audience (i.e. API) identifier for AccessToken. Must be registered with Auth0. * Note that this is required to ensure that issued token is a JWT and not an opaque string. */ audience: string; } /** * This class supports OAuth via an integration with Auth0, a commercial service supporting login * via Google, GitHub, Microsoft, and various other OAuth providers *or* via a username/password * combo stored and managed within Auth0's own database. Supported options will depend on the * configuration of your Auth0 app. * * Note: If developing on localhost and using Access Tokens will need to configure your browser to * allow third-party cookies. */ export declare class AuthZeroClient extends BaseOAuthClient { private client; protected doInitAsync(): Promise; protected doLoginRedirectAsync(): Promise; protected doLoginPopupAsync(): Promise; protected fetchIdTokenAsync(useCache?: boolean): Promise; protected fetchAccessTokenAsync(spec: AuthZeroTokenSpec, useCache?: boolean): Promise; protected doLogoutAsync(): Promise; protected interactiveLoginNeeded(exception: unknown): boolean; private createClient; private get loginScope(); private returningFromRedirect; private noteUserAuthenticatedAsync; }