Repository navigation
Description
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:
server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET) server.browser_authorize() ACCESS_TOKEN = str(server.fitbit.client.session.token['access_token']) REFRESH_TOKEN = str(server.fitbit.client.session.token['refresh_token']) auth2_client = fitbit.Fitbit(CLIENT_ID, CLIENT_SECRET, oauth2=True, access_token=ACCESS_TOKEN, refresh_token=REFRESH_TOKEN)
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