Search code examples
oauthproduction-environmentevernote

Error generating auth token in Evernote production using activated API key


A few days back I received mail from EverNote Developer Relations that my API key has been activated for the production environment. But when I try to generate auth token with the same consumer key and secret in the production environment I get the below error

Exception in thread "main" org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract token and secret from this: '<html>

Here is the code I use with the same consumer key and secret

    Class<? extends EvernoteApi> providerClass = EvernoteApi.class;

    // Generate Request token & Request secret
    String CONSUMER_KEY = "Same as used in SANDBOX";
    String CONSUMER_SECRET = "Same as used in SANDBOX";
    String cbUrl = "localhost";

    OAuthService service = new ServiceBuilder()
      .provider(providerClass)
      .apiKey(CONSUMER_KEY)
      .apiSecret(CONSUMER_SECRET)
      .callback(cbUrl)
      .build();

    Token scribeRequestToken = service.getRequestToken();

But when I use this in sandbox environment it works fine. Is this an issue with the API key activation?


Solution

  • The Consumer secret which I was using was incorrect. This problem got resolved after using correct consumer secret which was sent initially by evernote