Hi There.
Starting on 7/19/2023, we started getting 401 errors for a large percentage of our requests for user data, with this error message:
{ "error": { "code": 401, "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } }
I am able to replicate the issue in Postman as well, where I am clearly sending the bearer token.
Example: https://api.fitbit.com/1/user/53F54D/activities/date/xxxx-xx-xx.json
Answered! Go to the Best Answer.
Best Answer
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.
Hi @Jeff_New_Ocean and @DSGTeam
I want to let you know that we have fixed the "expired_token" error. We have reverted the error back to the syntax.
{
"success": false,
"errors": [
{
"errorType": "expired_token",
"message": "Access token expired: <access_token>. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
]
}
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.
Thanks for reporting this, @Jeff_New_Ocean
We've seen some variations of this problem but haven't found a solution yet. Let me research and get back to you.
Best Answer
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.
I need a little more information from you.
Best AnswerThanks @Gordon-C for getting back.
Best Answer
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.
I've been able to perform some investigation on this problem and sent it to our engineering team for further investigation. I'll let you know what I find out.
Best Answer
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.
Our engineering team is still looking into your specific problem. We've confirmed the 401 errors are not related to the current maintenance efforts being performed. However, they did notice a spike of errors occurring 5:00 UTC every day. Are you observing the same pattern? Can you tell me if your application is doing anything specific at this time, such as running a cron job to query user data?
Best Answer
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.
Hi @DSGTeam
I need a little more information from you.
Best AnswerCould this have something to do with the authentication changes you guys are making with google?
Best Answer@Gordon-C I was able to reproduce this on my personal account. I did a fresh authentication yesterday and it synced fine but later in the day, it started kicking the same error. This clued me into the fact that is has to be something with tokens. Today I manually updated my tokens by calling the post on https://api.fitbit.com/oauth2/token and once i had updated tokens, I made the call to get activities and now it works again. I am assuming that it will start failing again once the token expires.
Please note, this is being done from a service that we have not made changes to in a couple years so something must have changed on the fitbit side.
Best Answer@Gordon-C or @Jeff_New_Ocean, anything new on this? This is affecting a lot of our users and we need to get it resolved. I have not thought of any workarounds or fixes. Really could use some help.
Best Answer@Jeff_New_Ocean I think i figured it out. We are keying off of an error type of "expired_token". We are still getting 401 errors but the structure and message has changed.
It used to look something like
{"success":false,"errors":[{"errorType":"expired_token","message":"Access token expired: eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyMjlMTlYiLCJzdWIiOiI1M1M3UlAiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJyYWN0IHJzZXQgcnBybyIsImV4cCI6MTcyMjAzMjI4NSwiaWF0IjoxNzIyMDAzNDg1fQ.Rsh2uy-5BBTTKKY20IOxEKphMuvTMO1wiZ_nqKCqJBY. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}]}
Now it looks like
Best Answer
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.
Yes...I'm confirming the behavior. I don't think the error should have changed.
Best Answer
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.
Hi @Jeff_New_Ocean and @DSGTeam
Thank you for reporting this problem. I don't believe the error message should have changed. I have a reproducible for our engineering team and have asked them to look into the problem. I hope to have any update next week.
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.
Hi @Jeff_New_Ocean and @DSGTeam
I want to let you know that we have fixed the "expired_token" error. We have reverted the error back to the syntax.
{
"success": false,
"errors": [
{
"errorType": "expired_token",
"message": "Access token expired: <access_token>. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
]
}