重要信息:)OAuth中文版 http://163navy.blog.163.com/blog/static/105304086201042762510130/ TOC Appendix A.3. Requesting User Authorization The Consumer redirects Jane's browser to the Service Provider User Authorization URL to obtain Jane's approval for accessing her private photos. http://photos.example.net/authorize?oauth_token=hh5s93j4hdidpola&oauth_callback=http%3A%2F%2Fprinter.example.com%2Frequest_token_ready The Service Provider asks Jane to sign-in using her username and password and, if successful, asks her if she approves granting printer.example.com access to her private photos. If Jane approves the request, the Service Provider redirects her back to the Consumer's callback URL: http://printer.example.com/request_token_ready?oauth_token=hh5s93j4hdidpola
http://open.t.qq.com/resource.php?i=1,1
http://open.t.qq.com/resource.php?i=1,1&j=3
但是对桌面应用这一段没有什么帮助,调用接口没有要求提供QQ号和QQ密码,所以不是直接使用JSON的方式的。
谢谢关注。
路漫漫啊。
这里对认证过程又说了一次
http://open.t.qq.com/resource.php?i=1,2腾讯微博API通过以下四个步骤来完成认证授权并访问或修改受限资源的流程1.获取未授权的Request Token(temporary credentials)
2.请求用户授权Request Token
3.使用授权后的Request Token换取Access Token(token credentials)
4.使用 Access Token 访问或修改受保护资源 依然没有提到QQ号和密码。
http://163navy.blog.163.com/blog/static/105304086201042762510130/
TOC
Appendix A.3. Requesting User Authorization
The Consumer redirects Jane's browser to the Service Provider User Authorization URL to obtain Jane's approval for accessing her private photos. http://photos.example.net/authorize?oauth_token=hh5s93j4hdidpola&oauth_callback=http%3A%2F%2Fprinter.example.com%2Frequest_token_ready
The Service Provider asks Jane to sign-in using her username and password and, if successful, asks her if she approves granting printer.example.com access to her private photos. If Jane approves the request, the Service Provider redirects her back to the Consumer's callback URL: http://printer.example.com/request_token_ready?oauth_token=hh5s93j4hdidpola
供参考,我觉得有点类似,虽然我的领域没涉及过这些。
请继续关注,希望我能得到一个好的结果。谢谢。
https://open.t.qq.com/cgi-bin/request_token?oauth_callback=http://qunmgr.qq.com/authapi/callback.php&oauth_consumer_key=fb76ef232d6841e19f48428c12f36893&oauth_nonce=6915173b82c14b7d93c254fdc72910ba&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1292837077&oauth_version=1.0&oauth_signature=UKhR%2fsAx5PU3nD8UaSLkLJnmc9Q%3d
先登陆包这个比较简单 网上已有这个的算法了是这发信息的包
http://t.qq.com/publish.php
content=内容&countType=&pic&viewModel=
很简单的问题
自己多上上baidu找找~
数据抓最是怎么做的
Fiddler2 获得了更明确的错误信息
“
12
Invalid signature0
”
无效的签名。"1.获取未授权的Request Token本步骤用于签名的secret是AppKey Secret"不太明白这句话参考新浪的签名-不知道算法哪错了如果签名的方法错了,抓包分析也没用:(
string signatureBase = GenerateSignatureBase(url, consumerKey, token, tokenSecret, httpMethod, timeStamp, nonce, HMACSHA1SignatureType, out normalizedUrl, out normalizedRequestParameters); HMACSHA1 hmacsha1 = new HMACSHA1();
hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&{1}", UrlEncode(consumerSecret), string.IsNullOrEmpty(tokenSecret) ? "" : UrlEncode(tokenSecret)));
return GenerateSignatureUsingHash(signatureBase, hmacsha1);
我把callback函数改成了oob
就获得了正确的返回了。^_^7e
oauth_token=63350698757247848ad56c330c01f915&oauth_token_secret=83d98dbadb45c803063205baecd11c3d&oauth_callback_confirmed=true
0
生成URL:https://open.t.qq.com/cgi-bin/request_token?oauth_nonce=4tocg4y9u4p1v61ggk77d4hnoh6y20b8&oauth_signature=uDi7vBa0PJ7mIt107BSnt0Sghr0=&oauth_callback=www.qq.com&oauth_consumer_key=f14c1912e591496fa00671288817f418&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1302157322&oauth_version=1.0
上面的callback是我申请应用的时候填写的地址
public static String set_basestring() throws UnsupportedEncodingException {
String bss;
bss = "GET" + "&" + URLEncoder.encode(CONST.REQUEST_URL, "utf-8") + "&"; // bss = URLEncoder.encode(bss, "utf-8");
Log.e("OAUTH", "oauth_signature - Base1" + bss);
String bsss = "oauth_callback=" + "www.qq.com" + "&oauth_consumer_key="
+ CONST.APP_KEY + "&oauth_nonce=" + createRondomString()
+ "&oauth_signature_method=" + "HMAC-SHA1"
+ "&oauth_timestamp=" + createTimeStamp() + "&oauth_version="
+ "1.0";
bsss = URLEncoder.encode(bsss, "utf-8");
Log.e("OAUTH", "oauth_signature - Base2" + bsss);
return bss + bsss;
} /**
*
* @param data
* @param key
* get oauth_signature
* @return
*/
public static String hmacsha1(String data, String key) {
byte[] b = HMACSHA1.getHmacSHA1(data, key);
String s = new BASE64Enconder().encode(b);
return s;}