客户端身份验证及注入API请求
npm i ts-md5
服务端提供
appid
secret
公共请求参数
参数名 | 字段类型 | 说明 |
---|---|---|
appid | string | |
timestamp | string | 当前时间例如:2019-05-01 01:01:01 |
sign | string | 签名 |
登录的 token 使用headers
Authorization: Bearer token
签名方式
md5 签名
Md5.hashStr(appid + timestamp + secret)
注入
axios.interceptors.request
响应过滤
axios.interceptors.response
所有错误提示响应状态码都不是200
响应状态码401 时表示登录过期,需重新登录
Reprint please keep the original link: https://zodream.cn/blog/id/66.html