cadmium-docs-legacy/protocol-spec/account-login-by-username.md
2019-12-26 17:39:50 +04:00

1.5 KiB

Account login by username

Introduction

This extension is intended for logging into user account on a server by username

Message type identifiers

  • profile:login

Error Identifiers

  • invalid_creds: user ID/password isn't valid

Use cases

Request:

{
    "id": "abcd",
    "type": "profile:login",
    "to": "cadmium.org",
    "payload": {
        "username": "juliet",
        "password": "romeo1"
    }
}

Response:

{
    "id": "abcd",
    "type": "profile:login",
    "from": "cadmium.org",
    "ok": true,
    "payload": {
        "authToken": "3b5135a5-aff5-4396-a629-a254f383e82f",
        "deviceID": "ABCDEFG"
    }
}

Error response:

{
    "id": "abcd",
    "type": "profile:login",
    "from": "cadmium.org",
    "ok": false,
    "payload": {
        "errCode": "invalid_creds",
        "errText": "Username/password isn't valid"
    }
}

Business Rules

  • Ratelimit system: enabled

JSON Schema

Payload

  • Request:
interface LoginRequestPayload {
    /**
     * The username of account which user wants to login
     */
    username: string,


    /**
     * Password of new account
     */
    password: string
}
  • Response:
interface LoginResponsePayload {
    /**
     * Authentication token which required for various user actions (UUID)
     */
    authToken: string,


    /**
     * Identifier of new user device (created by this login action)
     */
    deviceID: string
}