So i have a curl command that goes out to a Whirlpool API and pulls down some JSON. I use OAuth2 and i can get the token back no problem, but when i pass the token in a msg.headers to the http request node, i always get back this response:
{"error":"invalid_token","error_description":"Cannot convert access token to JSON"}
I've tried to copy the token directly into the http node with bearer authentication turned on and i get the same response.
Here is my curl command that works fine:
curl -XGET -H "Authorization: Bearer ${TOKEN}" -H "Content-type: application/json" 'https://api.whrcloud.com/api/v1/appliance/xxxxxxxxxxxxx'
I've google and checked the forums, but just haven't come up with a solution to this.
I put the token in header “Authorization”:”Bearer “ + mytoken
I do not include application/json header.
I use default settings in http request node except my return type “a parsed json object” which is expected return type. Can leave default UTF-8 to test
What I found helpful is to use PostMan. Get it working there and then do Code -> Dart - http and copy the Uri.parse for the url and copy var headers section minus the Cookie.
I then add this to a function node prior to my http node.
msg.url=“…”;
msg.headers={…}
Thanks for the input. Figured out i was passing the username and password to get the token wrong (using client credentials and passing as headers instead of using Password). While it was returning a token, discovered the length was different from what was getting anywhere else and that led me to do digging on the oauth2 token call. Everything is working now.