Auth JSON Web Tokens
Method: POST
/api/ps/login
Headers
'Content-Type': 'application/json'
Parameters
deviceId
- Unique application key, requiredemail
- Unique login user, requiredpassword
- Secret key for authentication, required
Code samples
await fetch('/api/ps/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
deviceId: 'Unique key',
email: 'guest@keygenqt.com',
password: '12345678'
})
}).then(async (response) => {
console.log(response)
})
HTTP response status codes
Status code | Description |
---|---|
200 | OK |
400 | Bad Request |
422 | Form validate |
500 | Internal Error |
Status: 200
{
"id": 1,
"email": "guest@keygenqt.com",
"role": "GUEST",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBdXRoZW50aWNhdGlvbiIsImlzcyI6Imt0b3IuaW8iLCJpZCI6MSwiZXhwIjo0OTg1MDE2ODg2Nn0.uJxs8eep75HGywROEHcKuGX7l6NRledfv0pQg2s1QUJtqg7oYjPHtvR8oHYIAH05_c4xtoS5wuE02wjGpwqPnQ",
"refreshToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJSZWZyZXNoIiwiaXNzIjoia3Rvci5pbyIsImlkIjoxLCJpYXQiOjE2NjE1ODczMjR9.e1Vk13VsJihTPQI_uKn52Pe0B3EpqXEgE3i_GVkeH5nXHl01cOAOApuPyT1sAAW1ALD3h2WJhZBDjAJyBkJbcQ"
}
Status: 400
{
"code": 400,
"message": "Bad Request"
}
Status: 422
{
"code": 422,
"message": "Unprocessable Entity",
"validate": [
{
"filed": "password",
"errors": [
"Size must be between 8 and 12"
]
}
]
}
Status: 500
{
"code": 500,
"message": "Internal Error"
}