You are not logged in.

  • Index
  •  » Django
  •  » Django wapi & HTTP Basic Auth Authentication

#1 2010-01-07 10:32:13

redseam
Member
From: Alpine, UT
Registered: 2008-10-02
Posts: 13
Website

Django wapi & HTTP Basic Auth Authentication

I am trying my hand at writing an API in django using wapi (http://github.com/fiam/wapi).

I am using the HTTP Basic Authentication method as described in this tutorial http://fi.am/entry/building-a-website-a … a-api-aut/

I got it working and everything worked fine on my local dev environment. I have pushed it live and it seems there is a problem with the authentication - like it is not passing in the username and password I enter.

For example, I can enter https://inzolo.com/api/envelopes.xml ... if I have already logged into my site and there is a cookie stored it will return values as expected. If I am logged it it will prompt for my user name and password. I enter a correct username and password and it just keeps prompting me again again. I don't understand why it is not accepting it. Like I said, it works fine on my local dev and accepts the username and password.

Any ideas?


http://inzolo.com - Budget Happy!

Offline

 

#2 2010-01-07 16:47:00

redseam
Member
From: Alpine, UT
Registered: 2008-10-02
Posts: 13
Website

Re: Django wapi & HTTP Basic Auth Authentication

Been looking around and trying to load various modules in Apache mod_auth_basic, mod_authn_file, mod_authz_user, etc.

There are lots of mod_auth* modules. Do I just need to get the right combination?


http://inzolo.com - Budget Happy!

Offline

 

#3 2010-01-07 16:56:58

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: Django wapi & HTTP Basic Auth Authentication

I'm not familiar with WAPI basic authentication, but from what I can tell in the tutorial you mentioned, the authentication services are provided by Django (via the wapi module) so you shouldn't need to enable anything in Apache.

Offline

 

#4 2010-01-11 16:04:59

redseam
Member
From: Alpine, UT
Registered: 2008-10-02
Posts: 13
Website

Re: Django wapi & HTTP Basic Auth Authentication

I couldn't figure this out so I started looking at other Django API frameworks and started reading about Piston. I noticed this line in the docs:

Note: that using piston.authentication.HttpBasicAuthentication with apache and mod_wsgi requires you to add the WSGIPassAuthorization On directive to the server or vhost config, otherwise django-piston cannot read the authentication data from HTTP_AUTHORIZATION in request.META. See: http://code.google.com/p/modwsgi/wiki/C … orization.

I thought I had found the solution, but it still doesn't seem to be passing authentication after I added WSGIPassAuthorization to my http.conf file.


http://inzolo.com - Budget Happy!

Offline

 

#5 2010-01-11 18:05:56

redseam
Member
From: Alpine, UT
Registered: 2008-10-02
Posts: 13
Website

Re: Django wapi & HTTP Basic Auth Authentication

Solved!

I was running Django (1.0.2)/mod_wsgi (2.0)/Python (2.5), I upgraded to Django (1.1.1)/mod_wsgi (2.5)/Python (2.5). Now, with the "WSGIPassAuthorization On" it works.


http://inzolo.com - Budget Happy!

Offline

 

#6 2010-01-11 18:46:17

klynton
Administrator
From: Utah
Registered: 2009-08-31
Posts: 429
Website

Re: Django wapi & HTTP Basic Auth Authentication

Great. Thanks for letting us know the fix!

Offline

 
  • Index
  •  » Django
  •  » Django wapi & HTTP Basic Auth Authentication

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson