我可以指导用户的网址是什么,以便他们可以授予我的应用程序访问其goodreads帐户的权限?我在https://www.goodreads.com/api找到了goodreads文档,可能忽略了一些我无法解决的问题。
我要求好读'用户ID为'在成员货架上获取图书' https://www.goodreads.com/api#shelves.list
我的第一个障碍是让对话框弹出用户登录他们的goodreads帐户,这有效地授予我的应用程序访问他们的goodreads数据的权限。
.....
问题的延续 - 最后一个解析函数" TypeError:无法读取属性'解析'未定义"
Meteor.methods({
getGoodreads: function () {
var oauth = { callback: 'http://localhost:3000/profile/',
consumer_key: 'keyxkeyx',
consumer_secret: 'secreckeyxxsecreckeyxx'
},
url = 'http://www.goodreads.com/oauth/request_token';
request.post({url:url, oauth:oauth}, function (e, r, body) {
var req_data = qs.parse(body);
var uri = 'http://www.goodreads.com/oauth/authorize'
+ '?' + qs.stringify({oauth_token: req_data.oauth_token});
var auth_data = qs.parse(body),
oauth =
{ consumer_key: 'keyxkeyx'
, consumer_secret: 'secreckeyxxsecreckeyxx'
, token: auth_data.oauth_token
, token_secret: req_data.oauth_token_secret
, verifier: auth_data.oauth_verifier
},
url = 'http://www.goodreads.com/oauth/access_token';
console.log(auth_data); // this successfully prints the oauth_token and oauth_token_secret
request.post({url:url, oauth:oauth}, function (e, r, body) {
var perm_data = new qs.parse(body), // "TypeError: Cannot read property 'parse' of undefined"
oauth =
{ consumer_key: 'keyxkeyx'
, consumer_secret: 'secreckeyxxsecreckeyxx'
, token: perm_data.oauth_token
, token_secret: perm_data.oauth_token_secret
},
url = 'https://www.goodreads.com/topic.xml',
qs = {user_id: perm_data.user_id,
key: 'keyxkeyx'};
request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {
console.log(user)
});
});
});
}
});
答案 0 :(得分:1)
Goodreads的授权网址为:
http://www.goodreads.com/oauth/authorize
查看(Ruby)代码示例