Jump to content
Sign in to follow this  

oAuth unexpected error

Recommended Posts

I am using GTMOAuth lib http://code.google.com/p/gtm-oauth/. It works perfectly with Twitter, Linkedin and others, but got unexpected server error from Evernote.

I am using sandbox environment with following URIs:

requestTokenURL https://sandbox.evernote.com/oauth

accessTokenURL https://sandbox.evernote.com/oauth

authorizeURL https://sandbox.ever...n?format=mobile

scope = @"https://sandbox.evernote.com"

callbackURL http://www.example.com/OAuthCallback

Mine sandbox account is: alohar

The error message is like this:

Oops...Unexpected error. Our server has experienced difficulties processing your request

Anyone can help?

Share this post

Link to post

At what stage of the OAuth process do you receive that error?

Share this post

Link to post

Sorry for the late response. The GMT library wrap the oAuth process into one single call, I will dig deep to see which stage it fails, but here is the complete error message. Note, I tried to use other service's oauth by replacing the end points, it works perfectly.



<meta charset="utf-8" />

<meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1" />

<meta name="viewport" content="width=device-width,initial-scale=1" />

<link rel="Shortcut Icon" href="/about/media/img/favicon.ico" type="image/x-icon" />

<link rel="stylesheet" href="/redesign/global/css/reset.css" />

<link rel="stylesheet" href="/redesign/global/css/fonts.css" media="all" />

<link rel="stylesheet" href="/redesign/global/css/header.css" />

<link rel="stylesheet" href="/redesign/global/css/layout.css" />

<title>Evernote error</title>



<div class="header">

<div class="logo-bar">

<a href="/" class="evernote-logo">Evernote</a>



<div id="container" class="wrapper">

<div class="page-header">




<p>Unexpected error.<br />

Our server has experienced difficulties processing your request

<script type="text/javascript">

if (self.location.pathname) {


document.write(self.location.pathname.replace(/</g, "<").replace(/>/g, ">"));




<br />

You may need to <a href="/Login.action">Sign</a> in to your account to access this page.</p>


<div class="clear"></div>


<div class="shadow wrapper">

<img src="/redesign/global/img/curved-drop-shadow.png"/>


<div class="footer wrapper">

<a href="/about/tos/" class="footer-entry">Terms of Service</a>

<a href="/about/privacy/" class="footer-entry">Privacy Policy</a>

<span class="footer-entry last">Copyright 2012 Evernote Corporation.</span>




Share this post

Link to post

Yah, unfortunately there's no detail in that error message, and I haven't spent any time working with GMTOAuth. There are some errors in our server logs indicating that an invalid parameter was passed: "OAuth parameters must either be 'scope' or start with 'oauth_'". I'm not sure that we actually need to be enforcing that restriction, but it may be what's causing your problem. Any idea what other parameters you're passing up?

Share this post

Link to post

There are two versions of GMTOAuth. I used OAuth1.0 and thrown above error. I switched to use OAuth2.0. It can display the login screen successfully now. But when I tried to login, I got error:

Please fix the following errors:

  • Missing required oauth parameter "oauth_token"

The only parameters I passed into that library are following:

tokenURL "https://sandbox.evernote.com/oauth"

authorizeURL "https://sandbox.evernote.com/OAuth.action?format=mobile"

redirectURI @"http://www.example.com/OAuthCallback";

my consumer key "alohar" and key is: 74c8585c50ce2a64

Any insight?

Share this post

Link to post

Please don't publish your consumer secret publicly. When you do, we need to go replace your consumer secret with a new one, which is work for both of us.

Our OAuth provider implements OAuth 1.0a. As such, you should use the OAuth 1.0 version of the library.

I ran the sample code that comes with the GTMOAuth 1.0 code and saw the same error that you're seeing. If you run a proxy like Charles, you'll see that the library appends &xoauth_displayName=OAuthSample-iPhone to the request URL, which is what's causing our provider to complain - we don't support that OAuth extension.

To prevent this value from being set, I removed kOAuthDisplayNameKey from the list of parameter keys returned by GTMOAuthAuthentication.tokenRequestKeys:

+ (NSArray *)tokenRequestKeys {
// keys for obtaining a request token, [url="http://oauth.net/core/1.0a/#auth_step1"]http://oauth.net/core/1.0a/#auth_step1[/url]
NSArray *keys = [NSArray arrayWithObjects:
// extensions
// kOAuthDisplayNameKey,
return keys;

I'm still getting an error, but in a different place. I'll have to dig deeper to see what's causing this. We've had success using https://github.com/g...coa/cocoa-oauth, see how that works for you in the meantime.

Update: I spoke too soon, the sample application works correctly once I remove the display name parameter from the request.

Share this post

Link to post
Sign in to follow this