09-29-2020 00:33 - edited 09-29-2020 12:18
09-29-2020 00:33 - edited 09-29-2020 12:18
I am trying to use the Fitbit Web API in Android app. These are the steps I have followed till now.
Call
Step 1 :
https://www.fitbit.com/oauth2/authorize?response_type=code&
client_id=<client_id>&redirect_uri=<redirect_uri>&scope=<scopes>&expires_in=<milliseconds>Get the code on the redirect uri.
Step 2 :
Calling ""https://api.fitbit.com/oauth2/token" in order to get the access_token in order to get the access to the other web api.
but when I try to call the above api I get "invalid_grant" with this response code
{
"errors": [
{
"errorType": "invalid_grant",
"message": "Authorization code invalid: <code here> Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
],
"success": false
}
This is the same response I get on Postman as well.
On Postman this is what I did.
1. Method type :
POST
2. URL Called :
https://api.fitbit.com/oauth2/token
3. Headers :
Authorization: Basic <Base64 encoded string of your application's client id and secret concatenated with a colon>
Content-Type: application/x-www-form-urlencoded
4. Body in x-www-form-urlencoded format
clientId : <client id>
grant_type : authorization_code
redirect_uri : <redirect url mentioned in the app>
code : <code that we get from step 1 on the redirect url>
Am I missing on anything? Can someone point in the correct direction?
Answered! Go to the Best Answer.
10-10-2020 19:52
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-10-2020 19:52
Based on the information you provided, it should work. For the authorization code, all you pulling all data between the = sign and the # sign? For example
https://example.com/?code=29ba1892e2431b1ead152e93c8d4b28c90f5e576#_=_
If you are, would you please try the authorization flow through the OAuth 2.0 Tutorial? This link will help you get started with it.
Best Answer10-10-2020 19:52
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
10-10-2020 19:52
Based on the information you provided, it should work. For the authorization code, all you pulling all data between the = sign and the # sign? For example
https://example.com/?code=29ba1892e2431b1ead152e93c8d4b28c90f5e576#_=_
If you are, would you please try the authorization flow through the OAuth 2.0 Tutorial? This link will help you get started with it.
Best Answer