第一次做有赞API调用,请帮帮忙看一下问题出在哪里!
我的构建流程如下:↓↓↓↓↓↓
签名调用接口: youzan.shop.get (获取店铺基础信息)
- ' 假设:
- AppSecret = “aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”
- AppID = “bbbbbbbbbbbbbbbbbb”
- method = “youzan.shop.get”
- timestamp = “2017-01-01 00:00:00”
- format = “json”
- v = “1.0”
- sign_method = “md5”
- ' 按字母先后顺序排序拼接再首尾加AppSecret,赋值给C
- C = “app_id” + AppID + “format” + format + “method” + method + “sign_method” + sign_method + “timestamp” + timestamp + “v” + v
- C = AppSecret + C + AppSecret
- ' 对C进行MD5加密,得到签名sign:
- sign = MD5 (C)
- ' MD5计算结果 sign的值是: “41a6b327d5fb8e18d3b52d69a112b970”
- ' 拼接参数:
- S = “method=” + method + “&v=” + v + “&format=” + format + “&sign_method=” + sign_method + “&sign=” + sign + “&app_id=” + AppID + “&app_secret=” + AppSecret + “×tamp=” + timestamp
- ' 构建URL:
- URL = “ https://open.youzan.com/api/entry/youzan.shop/3.0.0/get?” + S
- '
复制代码 ' 最后URL是: "https://open.youzan.com/api/entry/youzan.shop/3.0.0/get?method=youzan.shop.get&v=1.0&format=json&sign_method=md5&sign=41a6b327d5fb8e18d3b52d69a112b970&app_id=bbbbbbbbbbbbbbbbbb&app_secret=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa×tamp=2017-01-01 00:00:00"
测试时
AppSecret = “aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”
AppID = “bbbbbbbbbbbbbbbbbb”
timestamp = “2017-01-01 00:00:00”
都用真实的替换了
可是
用谷歌浏览器测试,返回的JSON总是:
{ "error_response": { "code": 40005, "msg": "签名校验失败" } }
请帮帮忙看一下问题出在哪里!
本帖最后由 sx.W 于 2017-5-30 10:03 编辑
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|