Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

User login

Michał B edited this page Nov 11, 2018 · 1 revision

User login

Important information

  • Available at URI: http://localhost:5000/user-management/users/token
  • Type of success response: 200 OK with user token
  • Type of error response: 400 with error message
  • HTTP method type: POST

Sending data

  • The data is sent in JSON format.
  • Request body consists of:
    • loginOrEmail: ulong representing the login or email hash, parsed to the string format
    • password: ulong representing the password hash, parsed to the string format

Example of the valid JSON request body:

{
    "loginOrEmail": "1231111111110056400",
    "password": "1111112312456789456"
}

Receiving data

  • If all data in JSON request are valid and user exists in the database, then WebAPI returns 200 OK with user token:
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiI4Iiwicm9sZSI6InVzZXIiL
CJuYmYiOjE1MzM5NTUwOTgsImV4cCI6MTUzNDEyNzg5OCwiaWF0IjoxNTMzOTU1MDk4LCJpc3M
iOiJodHRwOi8vbG9jYWxob3N0OjUwMDAifQ.5gfXdxY90qsHXK25G4L81TS0PC8FTyaCBX55cF
tc8iabCfjW6J9AM827Q5Uwn1ati6mZ7knaJbKFVaWK63HQfA

It also returns headers like content type, date, server

  • If data aren't valid or user doesn't exist, the WebAPI returns 400 Bad Request with error message.

For example, when the WebAPI receives not valid data:

{
    "Password": [
        "The length of 'Password' must be 20 characters or fewer. You entered 21 characters.",
        "Invalid value!"
    ],
    "LoginOrEmail": [
        "The length of 'Login Or Email' must be 20 characters or fewer. You entered 21 characters.",
        "Invalid value!"
    ]
}

Clone this wiki locally