08-10-2023 04:40
08-10-2023 04:40
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;
}
08-10-2023 16:42
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.
08-10-2023 16:42
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
Best Answer