Link Search Menu Expand Document

Login

/api/v2/user/login

Post

users


Purpose

To allow a registered user to login on the platform.

Body Content [input]

{
    auth_data: string,
    password: string
}

Returns if valid [output]

{
    uid: string,
    name: string,
    username: string,
    email: string,
    prev_email: string,
    jwt: string,
    error: 0
}

What the API does

  • Checks if there is a record in the users collection with a username or email corresponding to the value of the auth_data supplied [404].
  • Compares the saved hashed password with a hashed version of the one supplied to check if the password is correct [401].
  • Checks if the user’s account is activated using the stored active field from the retrieved collection record [403].
  • Sets the deactivated and reset bool to false and saves the record.
  • Generates a jwt using an algorithm for the header, a secret key for the key and uses the user’s uid as the iss part and a value of a defined number of minutes for the exp part of the payload.