当前位置:网站首页>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
边栏推荐
猜你喜欢

AOSP ~ NTP (Network Time Protocol)

Qt+vtk+occt reading iges/step model

Fluent: Engine Architecture

PHP导出word方法(一mht)

PHP export word method (phpword)

ES6 standard
![[MySQL special] read lock and write lock](/img/ac/e01c26882cc664ea2e5e731c5a8bab.png)
[MySQL special] read lock and write lock

Shardingsphere sub database and sub table < 3 >

OpenGL index cache object EBO and lineweight mode

实现验证码验证
随机推荐
(construction notes) learning experience of MIT reading
Dart: about grpc (I)
"Jianzhi offer 04" two-dimensional array search
Introduction to concurrent programming (II)
239. Sliding window maximum
Pki/ca and digital certificate
PHP export word method (phpword)
Niuniu's team competition
Sheet1$. Output [excel source output] Error in column [xxx]. The returned column status is: "the text is truncated, or one or more characters have no matches in the target code page.".
[official MySQL document] deadlock
MySQL time zone solution
手机号码变成空号导致亚马逊账号登陆两步验证失败的恢复网址及方法
【mysql官方文档】死锁
4000 word super detailed pointer
Experience container in libvirt
Solution to the second weekly test of ACM intensive training of Hunan Institute of technology in 2022
Differences between MySQL Union and union all
Introduction to the implementation principle of rxjs observable filter operator
Quantitative calculation research
Itext7 uses iexternalsignature container for signature and signature verification