Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KeyError: 'oauth_state'

Tags:

python

flask

Hi I am currently trying to test the code on https://github.com/futurice/whereareyou

I have a problem on the master server side.

The error received

Traceback (most recent call last):
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1997, in call
return self.wsgi_app(environ, start_response)
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/home/arms/.local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/arms/Project/whereareyou/app.py", line 112, in callback
google = get_google_auth(state=session['oauth_state'])
File "/home/arms/.local/lib/python2.7/site-packages/werkzeug/local.py", line 377, in 
getitem = lambda x, i: x._get_current_object()[i]
KeyError: 'oauth_state'

Please help. Thank you.

like image 253
Dave Mathers Avatar asked Nov 29 '25 04:11

Dave Mathers


1 Answers

I was facing the same problem when I was using session in my app with the following link provided by Flask :

http://127.0.0.1:5000/

Solution: It however perfectly works with http://localhost:5000/

Just replace your local IP address(127.0.0.1) with "localhost".

like image 70
vickyroy Avatar answered Nov 30 '25 17:11

vickyroy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!