Authentification module written in JavaScript using Node.JS, Express, SQLite3 and CryptoJS. Designed for future use in some of my projects.
param | typeof | required | example_value | desc |
---|---|---|---|---|
username | string | yes | 'creepy0964' | Username |
password | string | yes | '123456' | Password. Converted to MD5 |
http_code | desc | reason |
---|---|---|
200 OK | Server succesfully logged the user in | - |
401 UNAUTHORIZED | Invalid credentials | User not found / Incorrect password |
200 OK
{
'login': 'ok'
}
401 UNAUTHORIZED
{
'login': 'fail',
'reason': 'user not found'
}
param | typeof | required | example_value | desc |
---|---|---|---|---|
username | string | yes | 'creepy0964' | Username |
password | string | yes | '123456' | Password. Converted to MD5 |
http_code | desc | reason |
---|---|---|
200 OK | Server succesfully registered the user | - |
400 BAD_REQUEST | Invalid request body: some credentials are missing | No username / password is provided |
409 CONFLICT | User already exists | User already exists |
500 INTERNAL_SERVER_ERROR | Returned when error is not specified | - |
200 OK
{
'register': 'ok'
}
400 BAD_REQUEST
{
'register': 'fail',
'reason': 'no username / no password'
}
409 CONFLICT
{
'register': 'fail',
'reason': 'user already exists'
}
500 INTERNAL_SERVER_ERROR
{
'register': 'fail',
'reason': ''
}