文档中心
签名认证
更新时间: 2017-11-22 15:29:53 访问次数:5347

调用Winit API时,需使用到两个签名串:

  • 用户签名“sign”:用于标识万邑联账户/卖家;
  • 应用签名“client_sign”:配合使用基础参数“platform”,即创建应用时填写的“应用code”用于标识应用。

一、签名的拼接方法

用户签名,基础参数:sign

按字段名的字母顺序拼接(包括data中的json字符串也按此规则),将token放在字符串的两端并md5加密,如下所示: 用户签名串token + action + actionValue + app_key + app_keyValue + data + dataValue + format + formatValue + platform + platformValue + sign_method + sign_methodValue + timestamp + timestampValue + version + versionValue + token

对以上拼接后的签名串进行MD5运算,并转换成大写的32位签名。

用户签名sign = toUpperCase(MD5(用户签名串))

注:token是由客户/卖家 登陆万邑联->个人中心->获取token,直接可以在万邑联系统后台获得。

应用签名,基础参数:client_sign

按字段名的字母顺序拼接(包括data中的json字符串也按此规则),将client_secret放在字符串的两端,如下所示: 应用签名串 = client_secret + action + actionValue + app_key + app_keyValue + data + dataValue + format + formatValue + platform + platformValue + sign_method + sign_methodValue + timestamp + timestampValue + version + versionValue + client_secret

对以上拼接后的签名串进行MD5运算,并转换成大写的32位签名。

应用签名client_sign = toUpperCase(MD5(应用签名串))

注:client_secret是由开发者登陆开发者控制台,创建应用时生成,请参照《开发者控制台 操作手册》

二、示例
 请求报文:
                           {
    "action":"createOutboundOrder",
    "app_key":"rebecca",
    "client_id":"NGRKYWY2YJITYTE2NY00YTBLLWE4YZITYWMWYJEZN2YXMWVK",
    client_sign":"38B87482C92FFEF0F10292B7AFA44087",
    "data":{
        "address1":"1 Stafford Crt.",
        "address2":"aaaaaaa",
        "city":"Bayswater North",
        "deliveryWayID":"1010520",
        "eBayOrderID":"3298473480",
        "emailAddress":"abc@winit.com",
        "fromBpartnerId":"111",
        "insuranceTypeID":1000000,
        "isShareOrder":"N",
        "phoneNum":"15900001111",
        "productList":[
            {
                "eBayBuyerID":"98877456rere",
                "eBayItemID":"3434245",
                "eBaySellerID":"99887rtrtr66123",
                "eBayTransactionID":"24377766",
                "productCode":"LCD-IP4-01",
                "productNum":"1",
                "specification":""
            }
        ],
        "recipientName":"mingbao",
        "region":"WV",
        "repeatable":"Y",
        "sellerOrderNo":"PowerSellerABC123",
        "state":"US",
        "warehouseID":1000008,
        "zipCode":"25085"
    },
    "format":"json",
    "language":"zh_CN",
    "platform":"SELLERERP",
    "sign":"090C13832E59BD50543DAD0ACB4E5B6E",
    "sign_method":"md5",
    "timestamp":"2016-06-16 00:19:26",
    "version":"1.0"
}
                        
用户签名sign:
89435277FA3BA272DE795559998E-
actioncreateOutboundOrderapp_keyrebeccadata
{
    "address1": "1 Stafford Crt.",
    "address2": "aaaaaaa",
    "city": "Bayswater North",
    "deliveryWayID": "1010520",
    "eBayOrderID": "3298473480",
    "emailAddress": "abc@winit.com",
    "insuranceTypeID": 1000000,
    "phoneNum": "15900001111",
    "productList": [
        {
            "eBayBuyerID": "98877456rere",
            "eBayItemID": "3434245",
            "eBaySellerID": "99887rtrtr66123",
            "eBayTransactionID": "24377766",
            "productCode": "LCD-IP4-01",
            "productNum": "1",
            "specification": ""
        }
    ],
    "recipientName": "mingbao",
    "region": "WV",
    "repeatable": "Y",
    "sellerOrderNo": "PowerSellerABC123",
    "state": "US",
    "warehouseID": 1000008,
    "zipCode": "25085",
    "isShareOrder": "N",
    "fromBpartnerId": "111"
}
formatjsonplatformSELLERERPsign_methodmd5timestamp2016-06-16 00:19:26version1.0
89435277FA3BA272DE795559998E-
                        
应用签名client_sign:
YME1MJQ0ZMUTMTNMZC00YTDMLWEWM2QTNMY1MDC3OWNJYZQ2MZE0NTKYNZE1MJUWNZE5
actioncreateOutboundOrderapp_keyrebeccadata
{
    "address1": "1 Stafford Crt.",
    "address2": "aaaaaaa",
    "city": "Bayswater North",
    "deliveryWayID": "1010520",
    "eBayOrderID": "3298473480",
    "emailAddress": "abc@winit.com",
    "insuranceTypeID": 1000000,
    "phoneNum": "15900001111",
    "productList": [
        {
            "eBayBuyerID": "98877456rere",
            "eBayItemID": "3434245",
            "eBaySellerID": "99887rtrtr66123",
            "eBayTransactionID": "24377766",
            "productCode": "LCD-IP4-01",
            "productNum": "1",
            "specification": ""
        }
    ],
    "recipientName": "mingbao",
    "region": "WV",
    "repeatable": "Y",
    "sellerOrderNo": "PowerSellerABC123",
    "state": "US",
    "warehouseID": 1000008,
    "zipCode": "25085",
    "isShareOrder": "N",
    "fromBpartnerId": "111"
}
formatjsonplatformSELLERERPsign_methodmd5timestamp2016-06-16 00:19:26version1.0
YME1MJQ0ZMUTMTNMZC00YTDMLWEWM2QTNMY1MDC3OWNJYZQ2MZE0NTKYNZE1MJUWNZE5
                        
三、签名认证失败排查工具

您可以点击签名认证工具使用认证工具验证您的签名是否正确

四、特别说明

生成签名时需要注意一下几点:

  • ◆签名时参数必须按字母顺序从小到大排序(字典序);
  • ◆如果参数的值为空不参与签名,如JAVA中参数值为null的,不会参与签名("" 与 '' 认 为非空,需要参与签名);
  • ◆参数名区分大小写;
  • ◆在向WINIT发送HTTP请求时必须使用正确的编码格式(默认UTF-8)。
关键词