11-13-2019 12:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

Jogger
1
0
0
11-13-2019 12:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Got the access code using the GET request in browser. Used 'login' prompt and allowed access. code was returned in the browser url along with redirect url. Code i received was "a6ecaff0ae74fc56e25cf99138cfe15d46f3df37#_=_" (this has expired already)
- Now I am using this code in POSTMAN tool to get the access token.
- POST https://api.fitbit.com/oauth2/token
- Headers:
- Authorization: Basic <clientId:clientSecret>
- Used https://www.base64encode.org/ to endcode clientId:clientSecret
- Content-Type: application/x-www-form-urlencoded
- Authorization: Basic <clientId:clientSecret>
- Body:
- client_id:<id>
- grant_type:authorization_code
- redirect_uri:<uri> (this is the same rediret uri defined in fitbit app settings)
- code: a6ecaff0ae74fc56e25cf99138cfe15d46f3df37#_=_ <this is actual code received in the step1, please note the additional chars at the end i.e. #_=_ were received from fitbit)
- I have also tried sending these body params as query params with url encoded format but that does not work either.
- Error received is {"success":false,"errors":[{"errorType":"invalid_token","message":"Access token invalid: VDn4LDmAsmbAtJ07D47sUdnCvmCrJmQha4fx0e3No53IEw6k7OeCO8DmxhFTOmK3. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}]}
1 REPLY 1
11-15-2019 14:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



Fitbit Developer
2071
218
504
11-15-2019 14:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @amittaneja
Thank you for reaching out and providing such detail. I think the problem is related to #_=_. You should remove it from the authorization code. Also, you were correct to send client_id, grant_type, redirect_uri and code as body parameters.
Please try this change and let me know if it works for you.
Gordon
Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

