Passing Credentials From Desktop Application to Django App

Go To StackoverFlow.com

0

This is more of a general newbie question:

How do desktop applications that hook up to a service typically verify users? How would I do this for a Django app? Would it be as simple as passing the credentials to a blank view that checks the username / password?

How is it typically passed?

Thanks

2012-04-05 23:31
by aroooo


1

You can create a custom login view on the django side, as detailed here. Have it return a message based on the whether the username and password parameters (should probably be sent via a HTTP POST, preferably over SSL) were valid. On the desktop client, if the response is valid, it should get the value of the cookie that got sent along with the response, and it should keep that cookie with every HTTP request that is made for the rest of the session.

2012-04-06 13:59
by JeffS


0

Not sure what you meant, but for example if you want to check user's credentials from desktop python application by some method in django app, you can use httplib module and send POST request and then check the response you get. Make something kind of:

>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()

(Example taken from Python docs)

2012-04-06 13:50
by tony
Ads