Class ScuteSessionAbstract

Hierarchy

  • ScuteSession

Constructors

Properties

autoRefreshTicker: null | Timer = null
config: {
    autoRefreshToken: boolean;
    persistSession: undefined | boolean;
    refetchInverval: undefined | number;
    refetchOnWindowFocus: undefined | boolean;
}

Type declaration

  • autoRefreshToken: boolean
  • persistSession: undefined | boolean
  • refetchInverval: undefined | number
  • refetchOnWindowFocus: undefined | boolean
refreshDeferred: null | Deferred<{
    data: null;
    error: BaseHttpError;
} | {
    data: Session;
    error: null;
}> = null
refreshProxyCallback: null | (() => Promise<void | Partial<ScuteTokenPayload>>) = null

Type declaration

scuteStorage: ScuteStorage | ScuteCookieStorage
visibilityChangedCallback: null | (() => Promise<any>) = null

Type declaration

    • (): Promise<any>
    • Returns Promise<any>

Methods

  • Internal
    • fresh needs to be set to true to get the latest data from the server.

    Parameters

    • Optional fresh: boolean

      Fetch new data from the server

    • emitRefetchEvent: boolean = true

      Emit refetch event when getting fresh data

    Returns Promise<{
        data: {
            session: Session;
            user: null;
        };
        error: InvalidAuthTokenError;
    } | {
        data: {
            session: Session;
            user: ScuteUserData;
        };
        error: null;
    } | {
        data: {
            session: null;
            user: null;
        };
        error: ScuteError;
    } | {
        data: {
            session: Session;
            user: null;
        };
        error: null;
    }>

  • Get current session.

    Returns Promise<{
        data: {
            session: Session;
            user: null;
        };
        error: InvalidAuthTokenError;
    } | {
        data: {
            session: Session;
            user: ScuteUserData;
        };
        error: null;
    } | {
        data: {
            session: null;
            user: null;
        };
        error: ScuteError;
    } | {
        data: {
            session: Session;
            user: null;
        };
        error: null;
    }>

  • Set refresh proxy callback. This is useful when you do not want to pass the refresh token to the client.

    Send request to your backend server to refresh session with secret key in callback function.

    • Needs backend server

    Parameters

    Returns Promise<void>

Generated using TypeDoc