Question

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.

Was it helpful?

Solution

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.

AuthConsumer consumer = new DefaultOAuthConsumer( "myConsumerKey", "myConsumerSecret" );
consumer.setMessageSigner( new PlainTextMessageSigner() );
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 );

BTW, I got this answered through the community support forums, I'm not smart enough to figure it out on my own. ;-)

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top