pallets-eco / flask-openid

Flask-OpenID adds openid support to flask applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask Session is not working when flask-openid used in Google App Engine

rajendrakrp opened this issue · comments

Hi,

I am new to Flask and OpenID. I was trying to flask-openid in App Engine.

Followed the tutorial http://pythonhosted.org/Flask-OpenID/ and used GAE datastore to store information during authentication process. I used 'gaestore.py' and 'gaemodels.py' from https://code.google.com/p/djapps/source/browse/#hg%2Fdjapps%2Fauth%2Fopenid to store data in GAE datastore. It required some modifications in
flask_openid.py and gaestore.py.

Reproduction procedure:--
Download code from 'https://github.com/rajendrakrp/GAE-Flask-OpenID' and development server by issuing following command inside the app:

dev_appserver.py --port=9090 .

Follow the steps:--

  1. Open browser and enter localhost:9090/login as url.
  2. Enter 'OpenID' as 'yahoo.com'
  3. It will redirect to yahoo login page, enter your credentials.
  4. After signing into yahoo.com, page will be redirected to localhost:9090

The problem is - it should not redirect to localhost:9090, according to code, it should redirect to page 'create_profile.html'. This is because session data 'openid' stored in 'create_or_login()' function is not retained when control goes to 'create_profile()' function. I have added necessary debug steps also. Please verify.

Please let me know if you need more information. I tried to explain as much possible. I didn't get any reponse from stackoverflow also(http://stackoverflow.com/questions/16075126/using-flask-openid-in-app-engine).

Thanks in advance.

This may seem weird.I wrote some 'print' statements in 'flask_openid.py' for debugging purpose. Remove 'print' statement at line 357 in 'flask_openid.py', it worked.!!

What changes did you need to make to Flask-OpenID to make this work?

You did not need to modify the _default_store_factory function, but could have written a function in your app that returns the DatastoreStore() and pass that as store_factory to OpenID initialization.

Hi, Please find the diff at https://gist.github.com/rajendrakrp/8521417. Code checked out at this commit sha:1f41c29. I didn't get time to look into it again.

Okay, yeah, the only real modification seem to be the datastore, which could be fixed with the store_factory argument.

The pickle utf-8 encoding has been fixed in 723e590