使用 Evernote 进行 OAuth 身份验证(使用 Java+Signpost)
我正在尝试使用 OAuth 身份验证来连接到各种服务。对于这大部分,这是有效的(使用 twitter/photobucket 进行测试),但是使用 Evernote,我收到了 400 响应代码。
这是怎么回事?
OAuthConsumer consumer = new DefaultOAuthConsumer( "myConsumerKey", "myConsumerSecret" );
OAuthProvider provider = new DefaultOAuthProvider( "https://sandbox.evernote.com/oauth", "https://sandbox.evernote.com/oauth", "https://sandbox.evernote.com/OAuth.action" );
String authUrl = provider.retrieveRequest( consumer, OAuth.OUT_OF_BAND );
这适用于 Twitter + Photobucket,那么为什么 Evernote 不适用呢?我正在使用 Signpost 1.2,除了这一个提供商以外,它都很棒。
I'm attempting to use OAuth authentication to connect to a variety of services. For this most part, this works (tested with twitter/photobucket), but with evernote, I'm receiving a 400 response code.
What's wrong here?
OAuthConsumer consumer = new DefaultOAuthConsumer( "myConsumerKey", "myConsumerSecret" );
OAuthProvider provider = new DefaultOAuthProvider( "https://sandbox.evernote.com/oauth", "https://sandbox.evernote.com/oauth", "https://sandbox.evernote.com/OAuth.action" );
String authUrl = provider.retrieveRequest( consumer, OAuth.OUT_OF_BAND );
This works for Twitter + Photobucket, so why not evernote? I'm using Signpost 1.2, which has been great except for this one provider.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最有可能的是签名者。 Evernote 仅支持纯文本签名。您还可能收到 405,如果是这种情况,请重写
createRequest
方法以使用 GET 而不是 POST。顺便说一句,我通过社区支持论坛得到了这个答案,我不够聪明,无法自己解决这个问题。 ;-)
Most likely the signer. Evernote only supports plain text signing. You may also receive a 405, if that's the case override the
createRequest
method to use a GET instead of POST.BTW, I got this answered through the community support forums, I'm not smart enough to figure it out on my own. ;-)
我们最近添加了对 HMAC-SHA1 签名的支持,因此您不需要再更改 messageSigner。您需要使用 GET 而不是 POST。如需了解更多信息,请访问我们的论坛帖子。
We recently added support for HMAC-SHA1 signing, so you shouldn't need to change the messageSigner anymore. You will need to use GET instead of POST. More information is available from our forum post.