Options
All
  • Public
  • Public/Protected
  • All
Menu

Log in to a remote authentication service, using an OnlineWithAuthentication or an Online identity.

Hierarchy

  • Authenticator

Index

Properties

Readonly loginSupported

loginSupported: boolean

Returns true if authentication is avaiable and the login methods can be used, otherwise returns false. Currently, authentication is only available if Ditto was initialized with an identity of type 'onlineWithAuthentication'.

Readonly userID

userID: string

Return the currently logged-in user ID.

This will be null if there is no valid authentication or OnlineWithAuthentication/Online mode is not being used.

Methods

isAuthenticated

  • isAuthenticated(): boolean
  • Query whether Ditto has a valid authentication token.

    This will only be true when using an OnlineWithAuthentication or an Online identity, after a successful login. If the authentication token is allowed to expire then it will return false instead.

    Returns boolean

loginWithToken

  • loginWithToken(token: string, options?: any): Promise<void>
  • Log in to Ditto with a third-party token. Throws if authentication is not available, which can be checked with loginSupported.

    Parameters

    • token: string

      the authentication token required to log in.

    • Optional options: any

    Returns Promise<void>

loginWithUsernameAndPassword

  • loginWithUsernameAndPassword(username: string, password: string, options?: any): Promise<void>
  • Log in to Ditto with a username and password. Throws if authentication is not available, which can be checked with loginSupported.

    Parameters

    • username: string

      the username component of the credentials used for log in.

    • password: string

      the password component of the credentials used for log in.

    • Optional options: any

    Returns Promise<void>