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

error "Token response does not match the expected format"

ANSWERED

I registered a 'Personal' app to try to download my personal minute-by-minute data. When I use the Fitbit API Debug Tool (OAuth2.0 tutorial page), I got an error at step 2, which says "Token response does not match the expected format; please check that you're using the correct OAuth 2.0 flow." Below is a screen shot to show this error. 

 

Capture.JPG

 

I've chosen the 'Authorization code flow' at step 1. Can anyone give me a hint what might have gone wrong? Thanks! 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Shushi2000, I see that what you do is actually just copying and pasting the curl from step 1A into step 2. This is not how it suppose to work. You need actually to execute your curl in command line, that you given at step 1A when you entered the code. 

So, just copy that curl and run it in command line. You should get json response as a result. This son response you need to copy and paste at input section in step 2.

View best answer in original post

Best Answer
13 REPLIES 13

I am getting the same.

Best Answer
0 Votes

Also seems to be some 404 errors on the page.

Not sure if this has anything to do why this isnt working?

 

https://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js

https://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js 

Best Answer
0 Votes

Hi, 

 

The reason you are seeing this error - "Token response does not match the expected format; please check that you're using the correct OAuth 2.0 flow." is because you are pasting the Curl itself in the textbox instead of pasting the response of the Curl. It should work once you paste the response from the Curl that is generated. 

 

Best Answer
0 Votes

I am passing it through Hurl.it and getting a 401 error.

 

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

I have tried putting the the Basic value in the header and the authentication bit of Hurl.it

Best Answer
0 Votes

Can you please PM to me what exactly you passing to hurl.it?

Best Answer
0 Votes

I am having the same problem. I've tried php wrappers and python wrappers, and I have no luck with this process. 

 

When I hurl the curl string in the tutorial right from the fitbit developer page, I still get error messages. Any thoughts?

Best Answer
0 Votes

deleted, meant to send this message as PM. 

 

bump

Best Answer
0 Votes

DeepaFitbit: Can you please give an example of how to paste the response from the Curl properly ?

Best Answer
0 Votes

Hi kylarione,

 

Can you can you send me your curl please? I can then show you what I mean by the response from it.

 

Thanks,

Deepa

Best Answer
0 Votes

Here it is: 

 

curl	-X POST -i 
-H 'Authorization: Basic [EDITED:removed security sensitive data]' 
-H 'Content-Type: application/x-www-form-urlencoded' 
-d "clientId=228LRD" 
-d "grant_type=authorization_code" 
-d "redirect_uri=http%3A%2F%2Flocalhost%2Ffitbit%2F" 
-d "code=2c74274d307395eb1396cd9b2953532ee3988467" 
https://api.fitbit.com/oauth2/token
Best Answer
0 Votes

Shushi2000, I see that what you do is actually just copying and pasting the curl from step 1A into step 2. This is not how it suppose to work. You need actually to execute your curl in command line, that you given at step 1A when you entered the code. 

So, just copy that curl and run it in command line. You should get json response as a result. This son response you need to copy and paste at input section in step 2.

Best Answer

Could you be more specific? I have no idea what "copy the curl and run it in command line" means. Copy the whole text box? where in the command line? the python virtual environment? what is an example code I am supposed to paste in the box? 

Best Answer
0 Votes

Sometimes, you need to replace '   ' with "  "  at the authorization part of the CURL. Try putting all parts of the CURL request in one line, separated by space, also delete all slashes that separate rows ( / ).

Best Answer
0 Votes