REST API returns get 'unsupported_grant_type' when requesting tokens for grant_type=authorization_code

1,557 views
Skip to first unread message

Darren Hill

unread,
May 19, 2015, 2:34:53 PM5/19/15
to ca...@googlegroups.com
Developer key: 030ea81d-27d2-4650-87bc-647b85fa5757


I've successfully gotten a code from the redirect url (like this, old one w_22jz0fMdVuuK2qENEA6l3Pg4msarNE2-lbKADzUxY )
but every time I post to

post URL:
https://api.channeladvisor.com/oauth2/token?grant_type=authorization_code&code=w_22jz0fMdVuuK2qENEA6l3Pg4msarNE2-lbKADzUxY&redirect_uri=xxxxxxxxx

I get back a response code of 400 but when content

{"error":"unsupported_grant_type"}

However the grant type, bolded above, is cut and paste from your docs.  Any ideas?

Thanks
Darren

[ChannelAdvisor] Marshall McClure

unread,
May 19, 2015, 4:56:49 PM5/19/15
to ca...@googlegroups.com
Hi Darren,

At first glace, your POST URL seems right to me.  I will dig into this tomorrow and follow up once I find something.  Please let us know if you work it out on your own in the mean time.

Darren Hill

unread,
May 19, 2015, 5:31:12 PM5/19/15
to ca...@googlegroups.com
I posted a case ticket as well because of the note at the top of the page (Effective April 21st, 2014 the ChannelAdvisor engineering team will no longer answer specific support questions through this Google Group) Case # [01016811] Rest API invalid grant_type

I am easily able to do the SOAP credential flow and get an access token there so there is that work around.  

{
    "access_token": "HOeuQmOn0hfXXXXXXXXXXXXDvf8toSR0nhDQg",
    "token_type": "bearer",
    "expires_in": 3599
}

I was tying to get the offline refresh toke so I could refresh an access token as needed.   I'm trying to make orders in our "system2" without the need for human interaction. 

[ChannelAdvisor] Marshall McClure

unread,
May 20, 2015, 10:16:55 AM5/20/15
to ca...@googlegroups.com
The support team should be able to take care of this, so I will leave it in their hands.  The SOAP flow should work fine for you in the mean time, since it allows you to essentially use your SOAP credentials as a refresh token.

Darren Hill

unread,
May 20, 2015, 2:37:18 PM5/20/15
to ca...@googlegroups.com
As a side note:
You added a token access(just the other day) to the developer console.  Would it be possible, in a future update, to add a way to see your refresh token there as well?  That would side step the process for automation from having to get the initial refresh token by hand(or build in a one time only process) before being able to fully automate.


[ChannelAdvisor] Marshall McClure

unread,
May 20, 2015, 4:02:52 PM5/20/15
to ca...@googlegroups.com
It's funny you should ask.  We hot rolled a change today to do just that, so please give it a try and let us know if you have any issues.

General Black

unread,
May 16, 2016, 1:01:08 AM5/16/16
to ChannelAdvisor Developer Network
I am facing this exact issue and don't really understand what the solution is. 

Can you help explain what fixed the problem?
Reply all
Reply to author
Forward
0 new messages