Class LoginManager

Module to handle user logins into RSX Cloud Server. The login mechanism is similar to modern web application where JWT token is issues upon successful login. The token is then used to authenticate the user for further requests. The module also handles token refreshes and offline mode.

Constructors

Accessors

  • get guestJWT(): string
  • Specifies a custom token to be used as a guest JWT token for access to the server.

    Returns string

  • set guestJWT(value): void
  • Parameters

    • value: string

    Returns void

  • get isLoggedIn(): boolean
  • Returns whether or not the user is logged in.

    Returns boolean

  • get isLoggingIn(): boolean
  • Returns whether or not the user is currently attempting a login.

    Returns boolean

  • get isOffline(): boolean
  • Determines if the offline mode is enabled.

    Returns boolean

  • get isRefreshingToken(): boolean
  • Returns whether or not the user is currently refreshing the token.

    Returns boolean

  • get isTokenRefreshRequired(): boolean
  • Determines if a token refresh is required. *

    Returns boolean

  • get jwt(): string
  • Gets the current JWT token, as required by the web services API. This is confidential information.

    Returns string

  • get messageOfTheDay(): string
  • Gets the message of the day as returned by the login response.

    Returns string

  • get userName(): string
  • Returns the current user ID (if logged in).

    Returns string

Methods

  • Initiates the OAuth login flow by opening the authorization URL in the system browser. On web builds, the returnURL is derived from the current page location. On desktop builds, the returnURL uses the rsxengine:// custom URL scheme.

    Returns void

  • Clears the Guest JWT token.

    Returns void

  • Logouts the user, if any is currently authenticated.

    Returns void

  • Refreshes the cached subscription information from the server. The cache is updated on success and {

    Returns void

  • Enables the offline mode. In offline mode, no changes are synced.

    Parameters

    Returns boolean

    true if the offline mode was enabled.

    To enter the offline mode, a persisted token must be available. If no credentials are available this method will return false and log an error.

Events

onOAuthURLOpened: Event<[p0: string], void>

Fired when an OAuth callback URL is received. The parameter is the full URL.

onUserLoginStatusChanged: Event<[p0: LoggedInUserInformation], void>

Gets called every time the user login/out status changed. First parameter denotes if logged in.

onLatestVersionInformationChanged: Event<[p0: CloudVersionInformation], void>

Gets called every time the latest version information changes.

onUserTokenChanged: Event<[p0: string], void>

Gets called every time the user token changed. Either by logout, login or token refresh.

onEncryptedUserCredentialsChanged: Event<[p0: string, p1: string], void>

Called whenever the user changes his encrypted credentials.

onSubscriptionInfoUpdated: Event<[p0: UserServiceSubscriptionInfo], void>

Fired whenever the cached subscription information is updated, including being cleared on logout.