【Vue Shop】客户端身份验证及注入API请求

Fork Me On Github

客户端身份验证及注入API请求

  
npm i ts-md5
12

服务端提供

appid

secret

公共请求参数

参数名 字段类型 说明
appid string
timestamp string 当前时间例如:2019-05-01 01:01:01
sign string 签名

登录的 token 使用headers

Authorization: Bearer token

签名方式

md5 签名

ts
  
Md5.hashStr(appid + timestamp + secret)
12

注入

ts
  
axios.interceptors.request
12

响应过滤

ts
  
axios.interceptors.response
12

所有错误提示响应状态码都不是200

响应状态码401 时表示登录过期,需重新登录

点击查看全文
0 90 0