Forums

web2py does not seem to support http authentication on PA

Hi -

I'm trying to do something along the lines of Restful API with HTTPS and authentication

And using notes here (https://groups.google.com/forum/#!searchin/web2py/authentication/web2py/e13XC9FHR3g/DL13ikpYDbkJ) and here (https://docs.python.org/2/howto/urllib2.html)

I have come to the conclusion that pythonanywhere may not be handling the standard WSGI_authentication as expected.

For Apache you would add this to the Apache config: WSGIPassAuthorization On but PA is using nginx.

Has anyone dealt with this issue before - any suggestions or solutions?

Thanks

Tom

OK, found the answer - there is a setting in web2py iteself that is required to allow http auth. See: http://web2py.com/books/default/chapter/29/09/#markmin_basic_authentication

insert this line into db.py after the rest of the auth settings

auth.settings.allow_basic_login = True

This allows the previously linked methods to work

glad you figured it out :)