[Django]-I'm using Django user authentication with PHP. Will this cookie based authentication scheme be secure?

3đź‘Ť

âś…

If you can unpickle in PHP what Django pickled into the session, then you can just grab the relevant session data directly form database (using session id from cookie), and then you’ll have a direct info which user is logged in Django site – if any.

EDIT:

Here’s the “encryption” Django uses:

http://code.djangoproject.com/browser/django/tags/releases/1.2.4/django/contrib/sessions/backends/base.py#L86

After “decrypting” you should get something like:

{
    '_auth_user_id': 123,
    '_auth_user_backend': 'django.contrib.auth.backends.ModelBackend',
}

— plus of course other session data you set yourself

0đź‘Ť

Do you know if it is possible to build a solution that works the other way around, i.e., that makes it possible to log into an PHP app and use this login information to log into an Django app without having to type username/password again?

Leave a comment