Skip to main content

Logging in users

A user must be logged in before they can start making actions (uploading, annotating, etc).

There are two ways to login a user. One is with a username & password, and the other is with an authentication token.

Username and password#

To login a user with a username and password, you can use the loginWithPassword function.

client.loginWithPassword(email, password): Promise<User>

The username and password provided will be passed into your verifyPassword function on the server. If the username and password are valid, the user will be logged in. If they are not, the promise will be rejected with an error.

Authentication token#

You can also login a user using an authentication token via the loginWithToken function.

client.loginWithToken(token): Promise<User>

This function will pass the authentication token into your getUserFromToken function on the server. If then token is valid, the user will be logged in, otherwise the promimse will be rejected with an error.

Next steps#