Link to home
Start Free TrialLog in
Avatar of jjrr007
jjrr007

asked on

Invalid Grant Type oAuth 2.0 Auth Token

I have been struggling with the following code for some time. I get the following eror: {"error":"invalid_request","error_description":"invalid grant type"}.

Some more documentation on the API that I am working on is available here:

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://id.shoeboxed.com/oauth/token",
   CURLOPT_RETURNTRANSFER => true,
  CURLOPT_SSL_VERIFYPEER => false, 
  CURLOPT_POST => 1,  
  CURLOPT_POSTFIELDS => "{\"code\": \"['code']\",\"grant_type\":\"authorization_code\",\"redirect_uri\": \"http://website.com/foursquare2.php\",\"client_id\": \"f8de67be8dc84e449203fcdd4XXXXXXX\",\"client_secret\": \"HS5ZeIVsKW0/qqiO9/XcdeWqnF8vtzQrpY8gcdrxg0BXNZXXXXXXX\"}",
  CURLOPT_HTTPHEADER => array(
    "application/x-www-form-urlencoded" 
  )
));


/*
//Another Attempt at it is below
curl -d code=['code'] \
    -d grant_type=authorization_code \
    --data-urlencode redirect_uri='http://website.com/foursquare2.php' \
    -u f8de67be8dc84e449203fcdd44abad5a:HS5ZXXXXXXX/qqiO9/XcdeWqnF8vtzQrpY8gcdrxg0BXNXXXXXXX \
    -XPOST https://id.shoeboxed.com/oauth/token 
*/


$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

?>

Open in new window

Avatar of Kyle Santos
Kyle Santos
Flag of United States of America image

Hi,

I am following up on your question.  Do you still need help?

If you solved the problem on your own, would you please post the solution here in case others have the same problem?

Regards,

Kyle Santos
Customer Relations
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.