"unsupported_grant_type" when requesting access token

2,343 views
Skip to first unread message

Nn Kk

unread,
Jul 12, 2018, 10:00:41 AM7/12/18
to ChannelAdvisor Developer Network

There are a few posts about this but I couldn't find one with an answer. API docs say to use the "authorization_code" grant_type, but I get a response saying that it is an unsupported type.

"{ ["Unauthorized"]=> string(0) "" } array(1) { ["error"]=> string(22) "unsupported_grant_type" }"


$params["grant_type"]     = "authorization_code";
$params["code"] = {auth code from previous step}
$params["redirect_uri"]   = {endpoint for app}

$auth = base64_encode("$application_id:$shared_secret");

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array('Content-type: application/x-www-form-urlencoded',
"Authorization: Basic $auth",
));
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

[ChannelAdvisor] Marshall McClure

unread,
Jul 12, 2018, 10:26:34 AM7/12/18
to ChannelAdvisor Developer Network
Hi,

Unfortunately, it is a known issue that the REST API occasionally returns an "unsupported_grant_type" error for requests that should have been successful. Assuming your request is valid, trying again should work.

Regards,
M

Nn Kk

unread,
Jul 12, 2018, 10:51:33 AM7/12/18
to ChannelAdvisor Developer Network
Thanks for the response. I've tried this call multiple times, with a few different authentication codes - since they're only valid for the first 5 minutes. I've also tried turning curl verify-host/peer off. All calls yield the same response.

[ChannelAdvisor] Marshall McClure

unread,
Jul 12, 2018, 11:02:33 AM7/12/18
to ChannelAdvisor Developer Network
In that case, it is likely that your request is incorrect somehow. Please either submit a support case at https://community.channeladvisor.com/s/support-center or email sup...@channeladvisor.com so our support team can provide assistance.

Regards,
M

Joe C.

unread,
Nov 12, 2020, 5:50:57 AM11/12/20
to ChannelAdvisor Developer Network
Did you ever find out what the problem was? following the documentation exactly with the examples yields the same issue for me. 

Joseph Cooper

unread,
Nov 12, 2020, 6:41:44 AM11/12/20
to ca...@googlegroups.com
I found the issue was Channel Advisor, I created a new application, updated the client ID and secret, worked first time. 

--
You received this message because you are subscribed to the Google Groups "ChannelAdvisor Developer Network" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadn+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadn/387986f2-18c9-4c45-bd78-aacf58fc2b89n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages