I have a problem with basic authentication in Rest Django framework. When I run the project on locallhost authentication work properly. I send login information in the request header (Authorization: Basic cm9vdDoxMjM0). In my API view, parameter request.user returns the logged in user. But if I try project in a production environment on a server, so parameter request.user returns value "AnonymousUser". Django rest framewrok runs on server with mod_fcgid.
My .htaccess:
AuthType None
Allow from All
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /projekty/qgame/mysite.cgi/$1 [QSA,L]
My settings.py:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
),
}
I think there will be a need to modify the Apache configuration. Do you know what it could be? Can it by something like this?
thanks