Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invalid authorization header format

ANSWERED

Hi,

This is the curl command that I'm running at the command line in Windows.

curl -X POST -i -H 'Authorization: Basic MjI4N0w1OmJlMDE1ZWY3MzgxYzk5ZjU3NTMxODA5MmYyYmFkZjUy' -H 'Content-Type: application/x-www-form-urlencoded' -d "clientId=2287L5" -d "grant_type=authorization_code" -d "redirect_uri=http%3A%2F%http://2Fexample123.co.uk " -d "code=12712fb5c424a27353aadc570904528b537fe842" https://api.fitbit.com/oauth2/token

The curl command was copy and pasted from the Tutorial test tool that can be accessed in the portal - so I guess its right?

This is the error that I'm seeing:
curl: (6) Could not resolve host: Basic
curl: (6) Could not resolve host: MjI4N0w1OmJlMDE1ZWY3MzgxYzk5ZjU3NTMxODA5MmYyYmFkZjUy'
curl: (6) Could not resolve host: application
HTTP/1.1 401 Unauthorized
Date: Sun, 01 Jan 2017 15:38:55 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-control: no-cache, private
WWW-Authenticate: Bearer realm="http://api.fitbit.com "
Content-Language: en-GB
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
Server: cloudflare-nginx
CF-RAY: 31a70f9e6db63446-LHR

{"errors":[{"errorType":"invalid_client","message":"Invalid authorization header format. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}

If you decode the Base64 it looks OK?
2287L5:be015ef7381c99f575318092f2badf52

Note: I've since deleted my Test Fitbit application that I registered in the portal for obvious reasons.

Any help with this would be most appreciated!

Thanks.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

The Fitbit tutorial page created a curl command that wrapped the Authoriation parameter with a ' (single quote) instead of a " (double quote).  Replacing the single quotes with double quotes fixes the problem.

Is this a bug in the tutorial web page?
This causes a problem if you run the curl command in Windows, however, I've not tried the command in UNIX.

View best answer in original post

Best Answer
2 REPLIES 2

The Fitbit tutorial page created a curl command that wrapped the Authoriation parameter with a ' (single quote) instead of a " (double quote).  Replacing the single quotes with double quotes fixes the problem.

Is this a bug in the tutorial web page?
This causes a problem if you run the curl command in Windows, however, I've not tried the command in UNIX.

Best Answer

@PaulSi The curl command works in UNIX without having to replace the single quotes.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer