11-22-2017 06:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-22-2017 06:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello!
I'm trying to refresh my access tokens, but I'm having some issues.
I've used the refresh token documentation from here.
I'll explain a bit how I'm trying to retrieve the new access tokens.
POST https://api.fitbit.com/oauth2/token
Headers: Content-Type: application/json
Authorization: Basic and a Base64 encoded string containing app_id:app_secret
In the body of the post I have:
{ "grant_type":"refresh_token", "refresh_token":"x" }
After posting I get the error:
{ "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." } ], "success": false }
What am I missing here? Thanks!
Answered! Go to the Best Answer.
Accepted Solutions
11-26-2017 03:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-26-2017 03:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This is quite awkward, but I have two Fitbit applications registered and I was using the wrong credentials..

11-23-2017 03:10 - edited 11-23-2017 04:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-23-2017 03:10 - edited 11-23-2017 04:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Oke, so finally I got it to work. The problem was that I was sending JSON in the body and not application/x-www-form-urlencoded formatted. But now a new problem occurred:
{"errors":[{"errorType":"invalid_grant","message":"Refresh token invalid: 1234567890. Visit https://dev.fitbit.com/docs/oauth2 for more information"}]}
I'm 100% sure that the refresh token is correct, because I revoked all the tokens and went through a new authorization code grant flow to get a new token. Also the headers are correct:
refresh_headers = ["Authorization": "Basic #{Base.encode64("client_id:client_secret")}", "Content-Type": "application/x-www-form-urlencoded"]
What could be the issue here?

11-26-2017 03:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-26-2017 03:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This is quite awkward, but I have two Fitbit applications registered and I was using the wrong credentials..

