Repository navigation
Description
Hi,
I am experiencing problems getting the oauth2 data.
First thing was, that cherrypy starts on 127.0.0.1, which makes my callback url unreachable.
If fixed it by adding a cherrypy config before quickstart, i also changed port to 80, as no other webserver is running:
cherrypy.config.update({'server.socket_host': '192.168.178.70', 'server.socket_port': 80 })
cherrypy.quickstart(self)
i opened port 80 on my router towards port 80 on the server where cherrypy is running.
i then started bin/nokia with all required parameters. the webserver is starting up and serving on the desired ip and port:
[22/Aug/2018:18:10:55] ENGINE Started monitor thread 'Autoreloader'.
[22/Aug/2018:18:10:55] ENGINE Serving on http://192.168.178.70
when entering the nokia url shown on the shell, i get to the correct page, but after clicking through, the page loads forever until i get a 500 Internal Server Error:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py", line 630, in respond
self._do_respond(path_info)
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py", line 689, in _do_respond
response.body = self.handler()
File "/usr/local/lib/python3.5/dist-packages/cherrypy/lib/encoding.py", line 221, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpdispatch.py", line 54, in __call__
return self.callable(*self.args, **self.kwargs)
File "/usr/local/bin/nokia", line 57, in index
self.creds = self.auth.get_credentials(code)
File "/usr/local/lib/python3.5/dist-packages/nokia/__init__.py", line 86, in get_credentials
client_secret=self.consumer_secret)
File "/usr/local/lib/python3.5/dist-packages/requests_oauthlib/oauth2_session.py", line 244, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 411, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 379, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 389, in validate_token_parameters
raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
any ideas?
and at least ip and port should be made configurable
ps: the server is reachable as i can telnet on it, also when accessing my outside IP directly without parameters, it is reacting:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-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 "/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py", line 630, in respond
self._do_respond(path_info)
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py", line 689, in _do_respond
response.body = self.handler()
File "/usr/local/lib/python3.5/dist-packages/cherrypy/lib/encoding.py", line 221, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpdispatch.py", line 60, in __call__
raise sys.exc_info()[1]
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpdispatch.py", line 58, in __call__
test_callable_spec(self.callable, self.args, self.kwargs)
File "/usr/local/lib/python3.5/dist-packages/cherrypy/_cpdispatch.py", line 157, in test_callable_spec
raise cherrypy.HTTPError(404, message=message)
cherrypy._cperror.HTTPError: (404, 'Missing parameters: state')
Activity
brad commentedon Aug 22, 2018
@psilo909 Thank you for the bug report! There must have been a last minute change that broke the CLI. The callback url (127.0.0.1) only needs to be reachable from the local browser, so no need to jump through hoops to get an externally accessible callback url. You do have to adjust the callback URL in your nokia app config. That said, I agree it should be configurable.
Port 80 is going to be a problem since that is a protected port. cherrypy won't be able to bind to it without sudo.
Please feel free to join us in http://gitter.im/python-nokia for real-time discussion. I am taking a look at the 500 error now, I see it too.
psilo909 commentedon Aug 22, 2018
@brad i am running the cherrypy on my reverseproxy, which is the entrypoint to my network. my nginx is stopped as long as i am using your oauth implementation, so no conflicts...
it just has a linux shell, no browser.. i dont want to open any port to my main computer, but i dont mind, i can configure it so its up to you
but from what i have learned: it will be sufficient to enter my LAN ip where cherrypy is running and do not need to do any port forwardings in my router?
i run i with sudo, so port 80 worked.
psilo909 commentedon Aug 22, 2018
Issue can be closed, important to keep in mind
i failed with running the script on my raspi3 (only shell) and using the browser on my windows pc