README.md 中的 entry.js 无法正常运行 #31

Closed
KJlmfe opened this Issue Apr 20, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@KJlmfe

KJlmfe commented Apr 20, 2013

你好,我的nodejs版本是v0.10.4 按照你README中说的方法,在执行 node entry.js 后:

{ [PublicTimelineError: source paramter(appkey) is missing]
data:
{ error: 'source paramter(appkey) is missing',
error_code: 10006,
request: '/2/statuses/public_timeline.json' },
name: 'PublicTimelineError' }

但是,我在weibo.init()中明明有填入appkey。

@NStal

This comment has been minimized.

Show comment Hide comment
@NStal

NStal May 12, 2013

我遇到了同样的问题.

NStal commented May 12, 2013

我遇到了同样的问题.

@zliu9

This comment has been minimized.

Show comment Hide comment
@zliu9

zliu9 Jun 19, 2013

同样的问题,作者能否看看这个bug

zliu9 commented Jun 19, 2013

同样的问题,作者能否看看这个bug

@fengmk2

This comment has been minimized.

Show comment Hide comment
@fengmk2

fengmk2 Jun 20, 2013

Owner

因为使用了oauth2,又由于没有登录授权,所以需要手动增加一个source参数: var cursor = {count: 20, source: appkey};

var weibo = require('../../');

// change appkey to yours
var appkey = 'your appkey';
var secret = 'your app secret';
var oauth_callback_url = 'your callback url';
weibo.init('weibo', appkey, secret, oauth_callback_url);

var user = { blogtype: 'weibo' };
var cursor = {count: 20, source: appkey};
weibo.public_timeline(user, cursor, function (err, statuses) {
  if (err) {
    console.error(err);
  } else {
    console.log(statuses);
  }
});
Owner

fengmk2 commented Jun 20, 2013

因为使用了oauth2,又由于没有登录授权,所以需要手动增加一个source参数: var cursor = {count: 20, source: appkey};

var weibo = require('../../');

// change appkey to yours
var appkey = 'your appkey';
var secret = 'your app secret';
var oauth_callback_url = 'your callback url';
weibo.init('weibo', appkey, secret, oauth_callback_url);

var user = { blogtype: 'weibo' };
var cursor = {count: 20, source: appkey};
weibo.public_timeline(user, cursor, function (err, statuses) {
  if (err) {
    console.error(err);
  } else {
    console.log(statuses);
  }
});

@ghost ghost assigned fengmk2 Jun 20, 2013

@fengmk2 fengmk2 closed this in ae042da Jun 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment