Skip to content

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

Closed
rajendrakrp opened this Issue Apr 18, 2013 · 4 comments

2 participants

@rajendrakrp

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.

@rajendrakrp

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.!!

@puiterwijk
Collaborator

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.

@rajendrakrp

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.

@puiterwijk
Collaborator

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

@puiterwijk puiterwijk closed this Jan 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.