cadmium-docs-legacy/protocol-spec/account-login-by-username.md

102 lines
1.5 KiB
Markdown
Raw Normal View History

# Account login by username
2019-12-22 14:39:30 +00:00
## Introduction
2019-12-22 14:39:30 +00:00
This extension is intended for logging into user account on a server by username
## Message type identifiers
2019-12-22 14:39:30 +00:00
- `profile:login`
2019-12-26 13:41:23 +00:00
## Errors
2019-12-22 14:39:30 +00:00
2019-12-26 13:41:23 +00:00
- Ratelimit system: enabled
2019-12-26 13:39:50 +00:00
- `invalid_creds`: user ID/password isn't valid
## Use cases
2019-12-22 14:39:30 +00:00
*Request*:
2019-12-22 14:39:30 +00:00
```json
{
"id": "abcd",
"type": "profile:login",
"to": "cadmium.org",
"payload": {
"username": "juliet",
"password": "romeo1"
}
}
```
*Response*:
2019-12-22 14:39:30 +00:00
```json
{
"id": "abcd",
"type": "profile:login",
"from": "cadmium.org",
"ok": true,
"payload": {
"authToken": "3b5135a5-aff5-4396-a629-a254f383e82f",
"deviceID": "ABCDEFG"
}
}
```
*<b>Error</b> response*:
2019-12-22 14:39:30 +00:00
```json
{
"id": "abcd",
"type": "profile:login",
"from": "cadmium.org",
"ok": false,
"payload": {
2019-12-26 13:39:50 +00:00
"errCode": "invalid_creds",
"errText": "Username/password isn't valid"
}
}
```
## Business Rules
2019-12-22 14:39:30 +00:00
2019-12-26 13:41:23 +00:00
None.
## JSON Schema
2019-12-22 14:39:30 +00:00
### Payload
- Request:
2019-12-22 14:39:30 +00:00
```typescript
interface LoginRequestPayload {
/**
* The username of account which user wants to login
*/
username: string,
2019-12-22 14:39:30 +00:00
/**
* Password of new account
*/
password: string
}
```
2019-12-22 14:39:30 +00:00
- Response:
2019-12-22 14:39:30 +00:00
```typescript
interface LoginResponsePayload {
/**
* Authentication token which required for various user actions (UUID)
*/
authToken: string,
2019-12-22 14:39:30 +00:00
/**
* Identifier of new user device (created by this login action)
*/
deviceID: string
}
```