Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • AuthApiInterface

Index

Properties

Readonly currentUser

currentUser: UserEntityInterface

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

Readonly onAuthenticationChanged

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

getToken

  • getToken(): string
  • Retrieves the locally stored JWT that can be used to authenticate requests.

    Returns string

    the locally stored JWT.

login

  • login(username: string, password: string, awaitDataLoad?: boolean): Promise<UserEntityInterface>
  • 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.

loginWithToken

  • 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.

logout

  • logout(): Promise<void>
  • Logs out the currently logged in user.

    Returns Promise<void>

    A promise that is resolved after the logout.

updateToken

  • updateToken(token: string): void
  • Updates the locally stored JWT access token such that it will be used to authenticate future requests.

    Parameters

    • token: string

      Valid JWT access token.

    Returns void

Generated using TypeDoc