(CakePHP)
define('EVERNOTE_SERVER', 'https://www.evernote.com');
define('EVERNOTE_NOTESTORE_HOST', 'www.evernote.com');
define('EVERNOTE_NOTESTORE_PORT', '443');
define('EVERNOTE_NOTESTORE_PROTOCOL', 'https');
define('EVERNOTE_REQUEST_TOKEN_URL', EVERNOTE_SERVER . '/oauth');
define('EVERNOTE_ACCESS_TOKEN_URL', EVERNOTE_SERVER . '/oauth');
define('EVERNOTE_AUTHORIZATION_URL', EVERNOTE_SERVER . '/OAuth.action');
define('EVERNOTE_OAUTH_CONSUMER_KEY', 'XXXXXX');
define('EVERNOTE_OAUTH_CONSUMER_SECRET', 'YYYYYY');
function beforeFilter(){
parent::beforeFilter();
$this->oauth = new OAuth(
EVERNOTE_OAUTH_CONSUMER_KEY,
EVERNOTE_OAUTH_CONSUMER_SECRET,
OAUTH_SIG_METHOD_HMACSHA1,
OAUTH_AUTH_TYPE_URI
);
}
function login(){
$request_token = $this->oauth->getRequestToken( EVERNOTE_SERVER.'/oauth', BASE_URL.'home/evernote/getback');
$this->Session->write('request_token', $request_token);
$this->redirect( EVERNOTE_SERVER.'/OAuth.action?format=mobile&oauth_token='.urlencode($request_token['oauth_token']));
}
function home_getback(){
$request_token = $this->Session->read('request_token');
$oauth_verifier = $this->params['url']['oauth_verifier'];
$this->oauth->setToken(
$request_token['oauth_token'],
$request_token['oauth_token_secret']
);
try { $access_token = $this->oauth->getAccessToken(EVERNOTE_SERVER.'/oauth', null, $oauth_verifier); }
catch( Exception $e ){
print_r($e);
}
}
It returned Exception $e and the content is like this.
{"lastResponse":"<html><head><title>Apache Tomcat\/6.0.32 - Error report<\/title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--><\/style> <\/head><body><h1>HTTP Status 401 - oauth_token<\/h1><HR size=\"1\" noshade=\"noshade\"><p><b>type<\/b> Status report<\/p><p><b>message<\/b> <u>oauth_token<\/u><\/p><p><b>description<\/b> <u>This request requires HTTP authentication (oauth_token).<\/u><\/p><HR size=\"1\" noshade=\"noshade\"><h3>Apache Tomcat\/6.0.32<\/h3><\/body><\/html>","debugInfo":null}
Some users can sign in without this error, however, some users encounter it.
Please tell me if you have any ideas!
Thanks.












