Interface AuthApiInterface

The Authentication API provides methods to log in or out, information about the current user, and a signal for when the logged-in user changes.

interface AuthApiInterface {
    currentUser: UserEntityInterface;
    onAuthenticationChanged: Signal<AuthenticationChangedHandler>;
    getToken(): string;
    login(username, password, awaitDataLoad?): Promise<UserEntityInterface>;
    loginWithToken(token, awaitDataLoad?): Promise<UserEntityInterface>;
    loginWithTokens(accessToken, uploadToken, awaitDataLoad?): Promise<UserEntityInterface>;
    logout(): Promise<void>;
    updateToken(token, uploadToken?): void;
}

Properties

currentUser: UserEntityInterface

Information about the currently logged in user. Will be a "guest" user if not logged in.

onAuthenticationChanged: Signal<AuthenticationChangedHandler>

Signal that is emitted after a user logged in or out. After logging out, the user will be a "guest" user.

Methods

  • Retrieves the locally stored JWT that can be used to authenticate requests.

    Returns string

    the locally stored JWT.

  • Logs in a user with the provided credentials.

    Note that this will only work with local NavVis IVION accounts, not with OAuth or pre-authentication.

    Parameters

    • username: string

      Name of the user.

    • password: string

      Password of the user.

    • Optional awaitDataLoad: boolean

      Optional flag that determines whether the returned promise should wait for the full initialization of NavVis IVION. Needs to be set true if the login promise is chained with some API functions. Defaults to false.

    Returns Promise<UserEntityInterface>

    A promise that is resolved after successful login and rejected if e.g. the provided credentials are invalid.

  • Logs in a user with the provided JWT, either for local NavVis IVION accounts or e.g. for OAuth Resource Server if the instance is set up to use one.

    Note that it also removes logout functionality from the UI and that NavVis IVION will not automatically refresh the token when it is about to expire. Use updateToken to apply an updated token before the previous one expires.

    Parameters

    • token: string

      Valid JWT.

    • Optional awaitDataLoad: boolean

      Optional flag that determines whether the returned promise should wait for the full initialization of NavVis IVION. Needs to be set true if the login promise is chained with some API functions. Defaults to false.

    Returns Promise<UserEntityInterface>

    A promise that is resolved after successful login and rejected if e.g. the provided token is invalid.

  • Logs in a user with the provided JWTs, either for local NavVis IVION accounts or e.g. for OAuth Resource Server if the instance is set up to use one.

    Note that it also removes logout functionality from the UI and that NavVis IVION will not automatically refresh the token when it is about to expire. Use updateToken to apply an updated token before the previous one expires.

    Parameters

    • accessToken: string

      Valid JWT.

    • uploadToken: string

      Valid JWT for uploads.

    • Optional awaitDataLoad: boolean

      Optional flag that determines whether the returned promise should wait for the full initialization of NavVis IVION. Needs to be set true if the login promise is chained with some API functions. Defaults to false.

    Returns Promise<UserEntityInterface>

    A promise that is resolved after successful login and rejected if e.g. the provided token is invalid.

  • Logs out the currently logged in user.

    Returns Promise<void>

    A promise that is resolved after the logout.

  • Updates the locally stored JWT access token such that it will be used to authenticate future requests.

    Parameters

    • token: string

      Valid JWT access token.

    • Optional uploadToken: string

      Optional, valid JWT for uploads.

    Returns void

Generated using TypeDoc