[Answer]-How do I authenticate remotely in Django?

1👍

Interesting. I’ve never done anything like this, but here is, what I assume, is the basic idea:

1) Get a good view of Django sessions; the basic idea is:

  • One logs in using the django auth framework login service
  • Django will create a session for you and handle all the difficult stuff
  • Django returns a HttpResponse with a sessionid cookie. You will need to send this back with any request following to identify yourself and ‘operate within the session’.
  • One logs out using the django auth logout service and the session is destroyed by Django.

2) Now, the rest is relatively easy.

  • Setup django urls.py with the appropriate urls for login/logout + computation service
  • Execute a post request to the login service with the appropriate parameters set
  • Catch the response, extract the ‘sessionid’ cookie and save it somewhere
  • On each subsequent request, include the sessionid

This should get you started. Good luck!

Leave a comment