Archive

Archive for May, 2017

Evernote PHP-SDK oauth_token missing

May 18th, 2017 No comments

Many people have problem with this when they want to use the official Evernote php-sdk. The example generates this error on many systems.

Missing required oauth parameter "oauth_token"

The issue happens in OauthHandler.php in function getTemporaryCredentials. There you will find a curl request and if you debug it you will see that it returns an empty result.

$info = curl_getinfo($handle);
print_r($info);
print_r("raw: ".$raw);
die();

Add this parameter to the request and it will work

CURLOPT_SSL_VERIFYPEER => 0

This basically tells you that your PHP installation is missing the required cacert.pem file. So open your php.ini file and find this parameter

curl.cainfo = ""

Download the latest cacert.pem file from https://curl.haxx.se/docs/caextract.html. Copy it to a local folder, I use “C:\Program Files\PHP\extras\ssl” and update the parameter in your php.ini

curl.cainfo = "C:\Program Files\PHP\extras\ssl\cacert.pem"

Restart IIS and it will work. Don’t forget to remove the CURLOPT_SSL_VERIFYPEER value from your curl request.

Categories: IIS Tags: , , , ,