Trails Packages
    Preparing search index...

    Manages the current user's authentication state.

    The current state (such as session info) can be retrieved and watched for changes.

    interface AuthService {
        getAuthState(): AuthState;
        getLoginBehavior(): LoginBehavior;
        getSessionInfo(): Promise<SessionInfo | undefined>;
        logout(options?: LogoutOptions): void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Returns the current authentication state.

      The state may initially be pending to allow for async initialization in the authentication plugin. After initialization, the state is either not-authenticated or authenticated.

      Use Reactivity API to watch the auth state.

      Returns AuthState

    • Returns the login behavior that should be performed if the user is not authenticated.

      The actual implementation of this component depends on the application's authentication plugin.

      Returns LoginBehavior

    • Returns the current user's SessionInfo or undefined, if the current user is not authenticated.

      The method is asynchronous to allow for async initialization in the authentication plugin.

      Returns Promise<SessionInfo | undefined>