Current session lost when redirecting via facebook oauth2

66 views
Skip to first unread message

Don Graham

unread,
Oct 1, 2013, 11:20:51 AM10/1/13
to django...@googlegroups.com
Hi

I'm running into a problem with django loosing the current session, when I redirect an AnnonymousUser to an facebook's oauth.  I set a session variable before sending a user to facebook to login via oauth. When they get redirected back to my site, the session key changes and the data is lost. Before the user is sent to facebook the session key "ciwz7qboun03pcan42pn8jew3gaphcuh" exist in the db.  When they return it seems to be deleted and replaced by an empty one.

I'm intercepting the redirected request using debug tool bar and I can see the following in the template context processor "django.core.context_processors.debug"

{u'debug': True, u'sql_queries': [
{u'sql': u"SELECT `django_session`.`session_key`, `django_session`.`session_data`, `django_session`.`expire_date` FROM `django_session` WHERE (`django_session`.`session_key` = 'ciwz7qboun03pcan42pn8jew3gaphcuh'  AND `django_session`.`expire_date`> '2013-10-01 14:57:27' )", u'time': u'0.001'},
{u'sql': u"SELECT (1) AS `a` FROM `django_session` WHERE `django_session`.`session_key` = 'vguth05jxwih234x0dwi8vao7xpw7s7r'  LIMIT 1", u'time': u'0.000'},
{u'sql': u'SAVEPOINT s140077883270912_x1', u'time': u'0.000'},
{u'sql': u"INSERT INTO `django_session` (`session_key`, `session_data`, `expire_date`) VALUES ('vguth05jxwih234x0dwi8vao7xpw7s7r', 'ZDQ5OWZmZmRmZmJkY2M2M2UyMDRmYjhlYTJlNTIzMzhjYzQ5NjQ5NDqAAn1xAS4=', '2013-10-15 14:57:27')", u'time': u'0.000'},
{u'sql': u"SELECT `django_session`.`session_key`, `django_session`.`session_data`, `django_session`.`expire_date` FROM `django_session` WHERE `django_session`.`session_key` = 'vguth05jxwih234x0dwi8vao7xpw7s7r' ", u'time': u'0.001'},
{u'sql': u"SELECT `django_session`.`session_key`, `django_session`.`session_data`, `django_session`.`expire_date` FROM `django_session` WHERE `django_session`.`session_key` = 'vguth05jxwih234x0dwi8vao7xpw7s7r' ", u'time': u'0.000'}]}


If the user is already logged into my site, this doesn't happen. 

Any suggestions or help would be greatly appreciated!

Thank you
Don
 


Reply all
Reply to author
Forward
0 new messages