The login function supplied by Django Channels provides non-persistent access to the Django session due to technical limitations.
The reason is that WebSockets are unable to modify HTTP cookies. Unfortunately, HTTP cookies are required to persist Django login state changes.
Proposed Actions
This might need to be implemented as a use_auth hook.
On a technical level, the following will need to be developed:
Server Side: Create a HTTP login view that accepts a UUID. This UUID will be attached to a session, which valid for 60 seconds (configurable). Somehow will need to refresh the scope['session'] after a successful authentication.
Client Side: Perform the login/logout via client JavaScript using the upcoming use_messenger hook. Will likely be an AJAX HTTP POST request.
Current Situation
The
login
function supplied by Django Channels provides non-persistent access to the Django session due to technical limitations.The reason is that WebSockets are unable to modify HTTP cookies. Unfortunately, HTTP cookies are required to persist Django login state changes.
Proposed Actions
This might need to be implemented as a
use_auth
hook.On a technical level, the following will need to be developed:
scope['session']
after a successful authentication.use_messenger
hook. Will likely be an AJAX HTTP POST request.