You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error on Fitbit authentication when setting up permissions: 500 Internal Server Error #142
When trying to set permissions for what data can be accessed by an application, I get a 500 Server Error
`500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 628, in respond
self._do_respond(path_info)
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 687, in _do_respond
response.body = self.handler()
File "/anaconda3/lib/python3.6/site-packages/cherrypy/lib/encoding.py", line 219, in call
self.body = self.oldhandler(*args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in call
return self.callable(*self.args, **self.kwargs)
File "/Applications/Fitbit/python-fitbit/gather_keys_oauth2.py", line 50, in index
self.fitbit.client.fetch_access_token(code)
File "/Applications/Fitbit/python-fitbit/fitbit/api.py", line 146, in fetch_access_token
code=code)
File "/anaconda3/lib/python3.6/site-packages/requests_oauthlib/oauth2_session.py", line 307, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/anaconda3/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 415, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/anaconda3/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response
validate_token_parameters(params)
File "/anaconda3/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 432, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/anaconda3/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client)
Powered by CherryPy 18.1.0`
Running this through a jupyter notebook using the following code:
hey I had a similar error. managed to solve it by setting the Callback URL (as well as what's in init in gather_keys_oauth2.py) to HTTPS. that way I could get the correct code to acquire an OAuth 2.0 token
I was having a similar problem and was able to solve it by downgrading the oauth2-related libraries to the following versions: requests-oauthlib == 1.1.0 and oauthlib == 2.1.0. I haven't tried to diagnose why the 500 error is thrown yet.
Reacted by dre2004, hm90079007, Katriona Goldmann, lime-red, Pooneet Thaper, Jeremy Brown and Duck
I was having a similar problem and was able to solve it by downgrading the oauth2-related libraries to the following versions: requests-oauthlib == 1.1.0 and oauthlib == 2.1.0. I haven't tried to diagnose why the 500 error is thrown yet.
hey I had a similar error. managed to solve it by setting the Callback URL (as well as what's in init in gather_keys_oauth2.py) to HTTPS. that way I could get the correct code to acquire an OAuth 2.0 token
Tried this, now getting a 404 error at the same point (clicking OK after selecting all data I want to be accessed). FWIW, I also can't connect to https://127.0.0.1/ in either chrome or safari.
404 Not Found
Missing parameters: state
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
return self.callable(*self.args, **self.kwargs)
TypeError: index() missing 1 required positional argument: 'state'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 628, in respond
self._do_respond(path_info)
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 687, in _do_respond
response.body = self.handler()
File "/anaconda3/lib/python3.6/site-packages/cherrypy/lib/encoding.py", line 219, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 60, in __call__
raise sys.exc_info()[1]
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 58, in __call__
test_callable_spec(self.callable, self.args, self.kwargs)
File "/anaconda3/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 157, in test_callable_spec
raise cherrypy.HTTPError(404, message=message)
cherrypy._cperror.HTTPError: (404, 'Missing parameters: state')
I was having a similar problem and was able to solve it by downgrading the oauth2-related libraries to the following versions: requests-oauthlib == 1.1.0 and oauthlib == 2.1.0. I haven't tried to diagnose why the 500 error is thrown yet.
This also worked for me!
Strange - I downgraded these two modules with pip and now I'm getting an error that it can' t find requests_oauthlib. I confirmed its installed in /anaconda3/lib/python3.6/site-packages.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-f3df68ffb3e9> in <module>()
----> 1 import fitbit
2 import gather_keys_oauth2 as Oauth2
3 import pandas as pd
4 import datetime
5 CLIENT_ID = '22D9V2'
/Applications/Fitbit/python-fitbit/fitbit/__init__.py in <module>()
8 """
9
---> 10 from .api import Fitbit, FitbitOauth2Client
11
12 # Meta.
/Applications/Fitbit/python-fitbit/fitbit/api.py in <module>()
13
14 from requests.auth import HTTPBasicAuth
---> 15 from requests_oauthlib import OAuth2Session
16
17 from . import exceptions
ModuleNotFoundError: No module named 'requests_oauthlib'````
Hey guys. Any updates on this? I can create a PR fixing the dependencies for requests-oauthlib and oauthlib if it helps, the library has been running without issues for me for about 2 weeks using these versions.
For whatever reason, it couldn't find the gather_keys_oauth2.py when I installed fitbit through pip. Had to create it manually as well as edit the redirect_uri to match my host set in my App.
Activity
y26805 commentedon Jan 22, 2019
hey I had a similar error. managed to solve it by setting the Callback URL (as well as what's in init in
gather_keys_oauth2.py) to HTTPS. that way I could get the correct code to acquire an OAuth 2.0 tokenskylergrammer commentedon Jan 23, 2019
I was having a similar problem and was able to solve it by downgrading the oauth2-related libraries to the following versions:
requests-oauthlib == 1.1.0andoauthlib == 2.1.0. I haven't tried to diagnose why the 500 error is thrown yet.dre2004 commentedon Jan 24, 2019
This also worked for me!
aparente commentedon Jan 24, 2019
Tried this, now getting a 404 error at the same point (clicking OK after selecting all data I want to be accessed). FWIW, I also can't connect to https://127.0.0.1/ in either chrome or safari.
aparente commentedon Jan 24, 2019
Strange - I downgraded these two modules with pip and now I'm getting an error that it can' t find requests_oauthlib. I confirmed its installed in /anaconda3/lib/python3.6/site-packages.
andreimarinescu commentedon Feb 2, 2019
I can also confirm that downgrading these libraries worked for me as well (I've used @dre2004's fork, thanks for that, by the way!).
andreimarinescu commentedon Feb 12, 2019
Hey guys. Any updates on this? I can create a PR fixing the dependencies for
requests-oauthlibandoauthlibif it helps, the library has been running without issues for me for about 2 weeks using these versions.brad commentedon Mar 5, 2019
@andreimarinescu That would be really helpful!
Update requirements
aparente commentedon Mar 25, 2019
Ok, so this is now working!
paulhoff commentedon Apr 27, 2019
Downgrading using:
pip install requests-oauthlib==1.1.0
pip install oauthlib==2.1.0
worked for me too!
Thanks all.
brad commentedon May 29, 2019
I think this is fixed with version 0.3.1 on PyPI. Please reopen if I'm wrong about this