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

Getting error Invalid request on grant type while generating token

JSONObject json = new JSONObject();

json.put("clientId", CLIENT_ID);

json.put("grant_type", "authorization_code");

json.put("redirect_uri", REDIRECT_URI);

json.put("code", "auth code");

json.put("code_verifier", "verifier code");

 

Error on highlighted line, i am getting below error.

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

Best Answer
0 Votes
5 REPLIES 5

Anyone can help?

Best Answer
0 Votes

@JohnFitbit can you please help. I will share complete code to you if you want

Best Answer
0 Votes

Can someone help on this?

Best Answer
0 Votes

(Moved to Web API forum.)

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Hi @maheshupadhyayn 

What programming language are you using?  These body parameters should be a single string separated by the & symbol, for example

grant_type=authorization_code&code=<authorization_code>&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&code_verifier=<code_verifier_value>

Can you confirm this is being performed by your code?

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes