> i'am writing API for a service and i want to use basic http
> authentication  for my service users.
>
> is there is something built in django.

Try something like this:

auth_header = request.META['HTTP_AUTHORIZATION']
auth_type, auth_str = auth_header.split()
if auth_type != 'Basic':
   # do something for invalid auth type here
decoded = base64.decodestring(auth_str)
user, passwd = decoded.split(':')
# write code to verify user and password here

Remember to "import base64" (it's built in to Python.)

-Rajesh D

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to