如何设置hello.js以访问Twitter?
我正在尝试编写一个简单的Javascript页面,用于使用Hello.js发送带有图片的tweet。我把它作为一个起点,但很多都没有真正解释清楚。我的init如下所示:如何设置hello.js以访问Twitter?,twitter,hello.js,Twitter,Hello.js,我正在尝试编写一个简单的Javascript页面,用于使用Hello.js发送带有图片的tweet。我把它作为一个起点,但很多都没有真正解释清楚。我的init如下所示: hello.init({ 'twitter' : '****' }); hello.init({ twitter: '<your Consumer Key>' }, {}); hello.init({ twitter : 'xxxxxx' },{redirect_uri : 'l
hello.init({
'twitter' : '****'
});
hello.init({
twitter: '<your Consumer Key>'
}, {});
hello.init({
twitter : 'xxxxxx'
},{redirect_uri : 'localhost',
oauth_proxy : 'https://auth-server.herokuapp.com',
oauth_version: 'xx' // probably 1.0a with hello.js
});
它说我需要“在OAuth代理服务中注册您的客户机id+客户机机密”。但是我该怎么做呢?我的应用程序的Twitter页面显示:
我应该把这些设置成什么?引用和域是否必须匹配代码中的某些内容?客户端id和客户端密码是消费者参数还是访问令牌参数?参考是网络名称,如“twitter”、“dropbox”等 域是您呼叫的域。它可以与类似“”的内容一起工作 对于Twitter,client_id是消费者密钥(API密钥),client_secret是消费者密钥(API secret) 完成后,在JS代码中只需添加如下内容:
hello.init({
'twitter' : '****'
});
hello.init({
twitter: '<your Consumer Key>'
}, {});
hello.init({
twitter : 'xxxxxx'
},{redirect_uri : 'localhost',
oauth_proxy : 'https://auth-server.herokuapp.com',
oauth_version: 'xx' // probably 1.0a with hello.js
});
hello.init({
推特:“”
}, {});
然后,带有以下代码的按钮应该可以工作:
<button onclick="hello( 'twitter' ).login()">Login with Twitter</button>
使用Twitter登录
我在hello.js和Twitter上遇到了很多问题,直到我最终发现:
- 如果您还没有一个工作域(您正在开发),那么您应该在您的应用程序的设置中在回调URL中编写127.0.0.1
hello.init({
'twitter' : '****'
});
hello.init({
twitter: '<your Consumer Key>'
}, {});
hello.init({
twitter : 'xxxxxx'
},{redirect_uri : 'localhost',
oauth_proxy : 'https://auth-server.herokuapp.com',
oauth_version: 'xx' // probably 1.0a with hello.js
});
该服务器将对您(在本例中)的Twitter API密钥进行身份验证。@NatiKrisi是由hello.js的开发人员运行的OAuth代理服务器