Updated on 2023-09-27 GMT+08:00

Authorization Interface

Description

This interface is used for interface authentication.

Interface Method

POST

URL

/chatbot/serverauth/login

Request Parameters

Table 1 Parameters in the request body

Parameter

Mandatory

Type

Length

Description

account

Yes

String

32

Sign-in account.

nonce

Yes

String

128

Original random text provided by the server, which comes from the "401 Unauthorized" message returned in the last business request.

checksum

Yes

String

512

Text encrypted by the client using the HMAC-SHA256 encryption algorithm based on the nonce value and local key.

Response Parameters

Parameter

Mandatory

Type

Length

Description

token

No

String

128

Token required by the business request interface. This parameter is mandatory when the authentication is successful.

duration

No

Integer

4

Token validity period, in seconds. This parameter is mandatory when the authentication is successful.

error

No

String

512

Error message returned when the authentication fails. The status code 401 is also returned.

nonce

No

String

128

Character string randomly generated by the server. This parameter is returned when the authentication fails.

Example

  • Request
    {
    "account":"odfs",
    "nonce":"*******", // Original random text provided by the server.
    "checksum":"0dbe11*******************0b505de" // Text encrypted by the client using the HMAC-SHA256 algorithm based on the nonce value and local key.
    }
  • Response
    {
    "token":"2**************************d",
    "duration":3600
    }