Stefan Kendall
Stefan Kendall

Reputation: 67802

OAuth Authentication with Evernote (Using Java+Signpost)

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.

Upvotes: 0

Views: 1459

Answers (2)

Seth
Seth

Reputation: 901

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.

Upvotes: 1

bcarlso
bcarlso

Reputation: 2345

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. ;-)

Upvotes: 2

Related Questions