Verify Message Authenticity

跳转到: 导航, 搜索
 
第1行: 第1行:
在开发者首次使用事件推送服务时,需要先通过一次校验来和微博服务器建立首次连接;微博服务器发送GET请求到开发者填写的URL上,校验参数如下表所示:
+
When developers use event pushing service for the first time, it need a check to build the connection with the weibo server; the weibo server send a get quest to the developer’s url, the check parameters are as follow:
  
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
|-
 
|-
!width="20%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|校验参数字段
+
!width="20%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameters
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
+
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameter type
!width="70%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
+
!width="70%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameter instructions
{{rdes_args|signature|string|微博加密签名,signature结合了开发者appsecret参数和请求中的timestamp参数,nonce参数}}
+
{{rdes_args|signature|string|Weibo encrypted signature, the signature combine the appsecret given by developers and the timestamp in the quest.}}
{{rdes_args|timestamp|string|时间戳}}
+
{{rdes_args|timestamp|string|timestamp}}
{{rdes_args|nonce|string|随机数}}
+
{{rdes_args|nonce|string|random number}}
{{rdes_args|echostr|string|随机字符串}}
+
{{rdes_args|echostr|string|Random string}}
 
|}
 
|}
  
  
signature参数的加密规则为:将appsecret参数,timestamp参数,nonce参数进行字典排序后,将三个参数字符串拼接成一个字符串进行sha1加密;开发者收到请求后,首先通过加密后的signature参数来校验GET请求的真实性,如果确认此次GET请求来自微博服务器,原样返回echostr参数内容就可以成功建立首次连接,否则连接失败。
+
The encrypt role of the signature parameter: sort appsecret、timestamp、nonce by dict, joint them to one string and then encrypt the string by sha1; after the developers receive the quest, it will use the encrypted signature to check the authenticity of the request, if the request came from the weibo server, it will establish the first connection by return the echostr parameter, or ,the connection will failed.
  
  
建立首次连接后,后续每次微博事件推送时也都会带上signature、timestamp、nonce三个参数,开发者依然可以通过对signature的校验判断此条消息的真实性。校验方式与首次建立连接一致。
+
Every weibo pushing event will carry on three parameters: signature、timestamp、nonce after the first connection. Developers also can check the authenticity by the signature parameter. The check method is same to the first connection.

2014年8月6日 (三) 18:03的最后版本

When developers use event pushing service for the first time, it need a check to build the connection with the weibo server; the weibo server send a get quest to the developer’s url, the check parameters are as follow:


Parameters Parameter type Parameter instructions
signature string Weibo encrypted signature, the signature combine the appsecret given by developers and the timestamp in the quest.
timestamp string timestamp
nonce string random number
echostr string Random string


The encrypt role of the signature parameter: sort appsecret、timestamp、nonce by dict, joint them to one string and then encrypt the string by sha1; after the developers receive the quest, it will use the encrypted signature to check the authenticity of the request, if the request came from the weibo server, it will establish the first connection by return the echostr parameter, or ,the connection will failed.


Every weibo pushing event will carry on three parameters: signature、timestamp、nonce after the first connection. Developers also can check the authenticity by the signature parameter. The check method is same to the first connection.

文档更新时间: 2014-08-06