1

I've installed WP OAuth Server to make an SSO thing with my Wordpress, but I can't get it to work proper.
I followed this example on how to set up Single Sign On. I'm stuck at Step 3.
I get this error:

object(stdClass)#1 (2) { ["error"]=> string(15) "invalid_request" ["error_description"]=> string(47) "The grant type was not specified in the request" } 

And here's the example code from step 3.

$curl_post_date = array(
'grant_type' => 'authorization_code',
'code' => $_GET['code'],
'redirect_uri' => '{http://example.net}'
);
$service_url = 'example.com/oauth/token';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "MY CLIENT ID:SECRET KEY"); //Your credentials goes here
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // If the url has https and you don't want to verify source certificate

$curl_response = curl_exec($curl);
$response = json_decode($curl_response);
curl_close($curl);

var_dump($response);

Step 3 should output somthing like this:

{
   "access_token":"2e5a2e729965f12a90cf977ad723c5533133a911",
   "expires_in":86400,
   "token_type":"Bearer",
   "scope":"basic",
   "refresh_token":"aed1d92c9b985ae1e770925497414b9d1238e41c"
}

How do I get step 3 to work as it should?

  • plugins are off-topic. you should ask the authors. – Mark Kaplun Sep 4 '15 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.