当前位置:网站首页>1-1 token
1-1 token
2022-07-03 12:15:00 【schr03p】
token Request validity verification
adopt appid and appkey And time , Then proceed md5 The algorithm obtains an encrypted value
Data encryption
AES To encrypt
Data exchange adopts AES Encryption algorithm encryption , secret key :appkey(32 by ), vector : Front of key 16 position , Pattern :CBC, fill :PKCS7
If the request parameters contain sensitive data ( Such as passwords ) You need to encrypt sensitive data Return the business data in the data (data Field ) Always encrypt , The client needs to decrypt itself
Symmetric encryption is faster than asymmetric encryption , Use a key
{
"code":1,
"message":"the message",
"data":" The encrypted string "
}request (Request)
Common parameters
Public request parameters refer to the parameters that each interface may need to pass , Public parameters pass header Pass on
| Parameters | explain | remarks | Whether it is necessary to transmit |
|---|---|---|---|
| appid | application ID | Get through the background | yes |
| version | Api Version number of | 1.0 | yes |
| platform | platform | iOS,Android | yes |
| system | Operating system version | android 10, iOS9 | |
| brand | Mobile phone brand | Apple , Huawei , millet ... | |
| model | Mobile phone model | Huawei P30, millet 10,iPhone x | |
| uuid | Device unique code | ||
| network | The Internet | wifi ,4G ,5G | |
| sign | Signature | Refer to the following signature mechanism | yes |
| timestamp | Time rubbing | yes | |
| token | user token | This parameter is required for interfaces that require login | Optional |
Other instructions
post The request data is an object , Convert to json
Common parameter conventions
Parameters explain Example page Pagination page number 1 size Paging data size per page 10, The default is 10 Others to be added
Respond to (Response)
All interfaces shall follow the following data format ,code Is the business status code ,http Relevant standards to be followed HTTP Status code
{
"code":1,
"message":"the message",
"data":{}
}| Field | explain | remarks |
|---|---|---|
| code | Status code | 1 To be successful ,0 It's failure . See the status code description table |
| message | error message | When code No 1 Return specific error information |
| data | Specific business data | Be careful : The data content is right JSON String after data encryption , Not in clear text |
Paging data structure convention
| Field | explain | remarks |
|---|---|---|
| page | The current page number | 1 |
| size | Data size per page | 10 |
| total_size | Total number of pages | 100 |
| total_page | Total number of pages | 10 |
Description of common status codes
| Status code | explain |
|---|---|
| 1 | success |
| 0 | Failure |
| 101 | appid Empty or app non-existent |
| 102 | Signature error |
| 103 | Invalid signature ( It has been used once ) |
| 104 | The request has expired ( Time stamp expired ) |
| 105 | Missing required parameters |
| 106 | The parameter format is incorrect or not submitted according to the rules |
| 201 | The lack of token |
| 202 | token Invalid / error |
| 203 | token Has expired |
| 401 | No permission to call |
| 501 | Database connection error |
| 502 | Abnormal reading and writing database |
Other business status codes are described separately in each interface
http Status code
200 OK The server returns the data requested by the user , The operation is idempotent
201 CREATED Create or modify data successfully
204 NOT CONTENT Delete data succeeded
400 BAD REQUEST There's a problem with the user's request , The operation is idempotent
401 Unauthoried Indicates that the user is not authenticated , Unable to operate
403 Forbidden User access is prohibited
422 Unprocesable Entity When creating an object , A validation error occurred
500 INTERNAL SERVER ERROR Server internal error , The user will not be able to determine whether the request was successful
503 Service Unavailable Service unavailable status , Mostly because of server problems , for example CPU Big occupancy , wait
边栏推荐
猜你喜欢
随机推荐
temp
023(【模板】最小生成树)(最小生成树)
Solutions to the failure of installing electron
Test classification in openstack
Redis notes 01: Introduction
Vulnhub's cereal
Redis
Flutter: self study system
MCDF Experiment 1
232. Implement queue with stack
OpenGL 绘制彩色的三角形
OpenGL index cache object EBO and lineweight mode
Dart: about Libraries
网上炒股开户安不安全?谁给回答一下
(构造笔记)从类、API、框架三个层面学习如何设计可复用软件实体的具体技术
Introduction to concurrent programming (II)
[learning notes] DP status and transfer
SLF4J 日志门面
Is BigDecimal safe to calculate the amount? Look at these five pits~~
(construction notes) learning experience of MIT reading

![[official MySQL document] deadlock](/img/2d/04e97d696f20c2524701888ea9cd10.png)







