首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

,腾讯微博API oauth_signature

2012-04-09 
求助,腾讯微博API oauth_signatureC# codeTimeSpan ts DateTime.UtcNow - new DateTime(1970, 1, 1, 0,

求助,腾讯微博API oauth_signature

C# code
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);            string G_oauth_nonce = Guid.NewGuid().ToString().Replace("-", "");            string G_oauth_timestamp = Convert.ToInt64(ts.TotalSeconds).ToString();            string requestMethod = "GET&";            string requestUrl = "https%3A%2F%2Fopen.t.qq.com%2Fcgi-bin%2Frequest_token";            string canshu = HttpUtility.UrlEncode("oauth_callback=null&oauth_consumer_key="+AppKey+"&oauth_nonce=" + G_oauth_timestamp + "&oauth_signature_method=HMAC-SHA1&oauth_timestamp=" + G_oauth_timestamp + "&oauth_version=1.0");            HMACSHA1 hmacsha1 = new HMACSHA1();            hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&{1}", HttpUtility.UrlEncode(AppSecret), HttpUtility.UrlEncode(requestMethod + requestUrl + canshu)));           string msg = "https://open.t.qq.com/cgi-bin/request_token?oauth_callback=null&oauth_consumer_key="+AppKey+"&oauth_nonce=" + G_oauth_nonce + "&oauth_signature=" +Convert.ToBase64String(hmacsha1.Key) + "&oauth_signature_method=HMAC-SHA1&oauth_timestamp=" + G_oauth_timestamp + "&oauth_version=1.0";           retrun oStream.ReadToEnd().ToString();




从早上9点一直被卡在oauth_signature 这个签名这边,到现在还是毫无进展,总是错的,401错误。

[解决办法]
HTTP 401.1 - 未授权:登录失败 
HTTP 401.2 - 未授权:服务器配置问题导致登录失败 
HTTP 401.3 - ACL 禁止访问资源 
HTTP 401.4 - 未授权:授权被筛选器拒绝 
HTTP 401.5 - 未授权:ISAPI 或 CGI 授权失败 

你是属于哪一种呢?
[解决办法]
参考:http://blog.csdn.net/fangxinggood/article/details/6629358
[解决办法]
看楼上的帖子就来了

OAuth 登陆方式已经成为主流的登陆方式。

原理都是一样。
[解决办法]
OAuth 已经 取代了 XAuth 
现在很多平台都取消 或 限制了 XAuth登陆的方式。

热点排行