import { Auth0Client, RedirectLoginResult, User } from '@auth0/auth0-spa-js'; /** * Configuration options for AuthManager * @param authentication An instaniated Auth0 Client * @param organization An id of an organization to login as * @param audience The top-level domain of the Photon API */ export interface AuthManagerOptions { authentication: Auth0Client; organization?: string; audience?: string; connection?: string; } /** * Configuration options for login * @param organizationId An id of an organization to login as * @param invitation An Auth0 invitation string * @param appState State to pass Auth0, which will be restored on redirect. Useful for redirecting back to the same page after login */ export interface LoginOptions { organizationId?: string; invitation?: string; appState?: object; } /** * Configuration options for logout * @param returnTo Where to redirect after logging out */ export interface LogoutOptions { returnTo?: string; federated?: boolean; } /** * Configuration options for getAccessToken * @param audience Audience to specify on the retrieved access token */ export interface GetAccessTokenOptions { audience?: string; } /** * Contains various methods for authentication (Auth0) */ export declare class AuthManager { private authentication; private organization?; private audience?; private connection?; /** * @param config - Photon AuthManager configuration options * @remarks - Note, that organization is optional for scenarios in which a provider supports more than themselves. */ constructor({ authentication, organization, audience, connection }: AuthManagerOptions); /** * Performs a login against the specified Auth0 domain * @param config - Login configuration * @returns */ login({ organizationId, invitation, appState }: LoginOptions): Promise; /** * Performs a logout against the specified Auth0 domain * @param config - Logout configuration * @returns */ logout({ returnTo, federated }: LogoutOptions): Promise; /** * Determines if URL has Auth0 parameters * @returns boolean */ hasAuthParams(searchParams?: string): boolean; private _getAccessToken; /** * Retrieves a valid access token * @param config - getAccessToken configuration * @returns */ getAccessToken({ audience }?: { audience?: string; }): Promise; /** * Retrieves a valid access token * @param config - getAccessToken configuration * @returns */ getAccessTokenWithConsent({ audience }?: { audience?: string; }): Promise; /** * Silently performs a getAccessToken and pre-populates the token and user information caches * @returns */ checkSession(): Promise; /** * Handes Auth0 redirect after login * @param url - The url which contains the code and state parameters (defaults to window.location.href) * @returns */ handleRedirect(url?: string): Promise | undefined>; /** * Retrieves information about the currently authenticated user * @returns */ getUser(): Promise; /** * Determines whether or not a user is currently logged in * @returns */ isAuthenticated(): Promise; }