02-18-2019 11:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-18-2019 11:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi,
I am trying to get Fitbit data however when I try to run my code I get an invalid client error. The error I get is as follows:
500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last): File "D:\GIT\healthRecSys\venv\lib\site-packages\cherrypy\_cprequest.py", line 628, in respond self._do_respond(path_info) File "D:\GIT\healthRecSys\venv\lib\site-packages\cherrypy\_cprequest.py", line 687, in _do_respond response.body = self.handler() File "D:\GIT\healthRecSys\venv\lib\site-packages\cherrypy\lib\encoding.py", line 219, in __call__ self.body = self.oldhandler(*args, **kwargs) File "D:\GIT\healthRecSys\venv\lib\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__ return self.callable(*self.args, **self.kwargs) File "D:\GIT\healthRecSys\src\gather_keys_oauth2.py", line 50, in index self.fitbit.client.fetch_access_token(code) File "D:\GIT\healthRecSys\src\fitbit\api.py", line 149, in fetch_access_token code=code) File "D:\GIT\healthRecSys\venv\lib\site-packages\requests_oauthlib\oauth2_session.py", line 307, in fetch_token self._client.parse_request_body_response(r.text, scope=self.scope) File "D:\GIT\healthRecSys\venv\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 415, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "D:\GIT\healthRecSys\venv\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 425, in parse_token_response validate_token_parameters(params) File "D:\GIT\healthRecSys\venv\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 432, in validate_token_parameters raise_from_error(params.get('error'), params) File "D:\GIT\healthRecSys\venv\lib\site-packages\oauthlib\oauth2\rfc6749\errors.py", line 405, in raise_from_error raise cls(**kwargs) oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client)
I hope someone can help me figure out what might be wrong. I have checked the client_id and it is exactly same as present online on the dev.fitbit.com/apps page for my application.
Regards,
Saksham
Answered! Go to the Best Answer.
Accepted Solutions
02-23-2019 22:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-23-2019 22:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hello Saksham!
Apparently it's a common problem, it can often be solved by downgrading the libraries requests-oauthlib==1.1.0 and oauthlib==2.1.0. There is more discussion on the python fitbit api github here: https://github.com/orcasgit/python-fitbit/issues/142.
Best wishes!
-Serena
02-23-2019 22:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-23-2019 22:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hello Saksham!
Apparently it's a common problem, it can often be solved by downgrading the libraries requests-oauthlib==1.1.0 and oauthlib==2.1.0. There is more discussion on the python fitbit api github here: https://github.com/orcasgit/python-fitbit/issues/142.
Best wishes!
-Serena
02-24-2019 10:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-24-2019 10:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks. Actually this is what I did and it worked out.

04-08-2019 02:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-08-2019 02:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
On my side we ran into the same issue and downgrading the python libraries did not solve it.
We are trying to fetch data for testing purpose first in Python, before pushing into our code.
We have OAuth 2.0 Application Type in settings set up to "server".
Our python libraries are
- oauthlib==2.1.0
- requests-oauthlib==1.1.0
- fitbit==0.3.0
The result remains an error message such as in the initial post.
Any Idea ???
