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

107 lines
1.7 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
2019-12-29 14:40:17 +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"
}
}
```
2019-12-29 14:40:17 +00:00
- 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"
}
}
```
2019-12-29 14:40:17 +00:00
- Error response:
2019-12-22 14:39:30 +00:00
```json
{
"id": "abcd",
"type": "profile:login",
"from": "cadmium.org",
"ok": false,
"payload": {
2020-07-16 08:04:56 +00:00
"errID": "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 {
/**
2019-12-29 14:40:17 +00:00
* The username of account which user wants to login (can be omit if we set thirdPID)
*/
username: string,
2019-12-22 14:39:30 +00:00
2019-12-29 14:40:17 +00:00
/**
* Third party ID which have user (can be omit if we set username)
*/
thirdPID: 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 {
/**
2019-12-29 13:01:35 +00:00
* Authentication token which required for various user actions (static SHA256 hash string from 4096 random characters)
*/
authToken: string,
2019-12-22 14:39:30 +00:00
/**
* Identifier of new user device (created by this login action)
*/
deviceID: string
}
2019-12-29 13:01:35 +00:00
```