02-28-2020 13:50
02-28-2020 13:50
Aloha, I have seen this same error posted in past posts, however none of the responses are working for me. I am using Axios inside of a React app.
I have successfully returned the auth_code, however when I make my post for the token I receive the following error:
Below is my POST:
form_data:client_id=[Redacted]&grant_type=authorization_code&redirect_uri=http%253A%252F%252Flocalhost%253A3000%252Fauth%252Fcallback&code=784544a4e1d789bc1a1f6692692795b74e8c28e6
I have confirmed my client id and secret numerous times.
Can you see where I am making a mistake?
02-28-2020 14:54 - edited 02-28-2020 15:06
02-28-2020 14:54 - edited 02-28-2020 15:06
Aloha @quinlayen
At a high-level, it looks like you have everything included correctly. However, I'm not familiar with your programming environment to know of its quirks. A few questions I have are
Gordon
02-28-2020 17:39
02-28-2020 17:39
Hi Gordon, thanks for replying.
Here are the answers to your questions:
1) yes there was more in the error. I pasted the entire error in the OP, which included the message which indicates it is an unauthorized header format.
2)Regarding the form_data, I guess I should have posted what it looked like in code so that it made more sense. I created an object named form_data and made that the body of the POST. I then console logged it and that log is what I put in the OP. Here is what the code looks like with a few changes to allow me to post here without giving private info:
03-02-2020 16:20
03-02-2020 16:20
Hi @quinlayen
I feel like something is not translating correctly with your code. I've been searching around for examples that might help and haven't found anything yet. Would you please provide me with your client ID. Maybe I can figure out what's going on in our logs.
Thanks!
Gordon
03-02-2020 16:35
03-02-2020 16:35
Also, instead of using stringify, have you tried listing out all of the parameters and their values to see if it works. For example,
body: "client_id=<value>&grant_type=authorization_code&..."
03-03-2020 14:36
03-03-2020 14:36
Hi @Gordon-C . I actually figured it out. I was urlencoding the redirect_uri as I thought I was supposed to, however that did not work in translation. Not sure why, but when I used just the url as is without encoding I was able to get it to work.
Thank you for taking the time to work this out for me.