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

suddenly getting 400 refresh token invalid when refreshing client tokens

Hello, we have been syncing with fitbit for years now without issues but suddenly now having issues syncing with fitbit. I think it has to do with refreshing tokens:

HttpStatus Code: BadRequest
{"errors":[{"errorType":"invalid_grant","message":"Refresh token invalid: redacted_token. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}

This is happening with all our clients. has anything changed on fitbit side? Some excerpts from c# code sending to the token url:

var data = "grant_type=refresh_token";
data += "&refresh_token=" + RefreshToken;
data += "&client_id=" + authApp.ClientID;
data += "&client_secret=" + authApp.ClientSecret;

using (WebClient wc = new WebClient())
{
var contentType = "application/x-www-form-urlencoded";
wc.Headers.Add("Content-Type", contentType);
wc.Headers.Add("Accept-Language", "en-US");
if (needAuth)
{
var bytes = Encoding.UTF8.GetBytes(authApp.ClientID + ":" + authApp.ClientSecret);
wc.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(bytes));
}

var response = wc.UploadString("https://api.fitbit.com/oauth2/token", Data);
return response;

}

Best Answer
0 Votes
1 REPLY 1

Hi @trevor_chong 

When did this problem begin?   If you can private message me your client ID, I can try to figure out what is causing the refresh token to fail.

Best,

Gordon

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