diff --git a/src/documents/tests/test_api_status.py b/src/documents/tests/test_api_status.py index b9c482b9c..ec3f9e611 100644 --- a/src/documents/tests/test_api_status.py +++ b/src/documents/tests/test_api_status.py @@ -57,7 +57,7 @@ class TestSystemStatus(APITestCase): """ response = self.client.get(self.ENDPOINT) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) - self.assertNotIn("WWW-Authenticate", response) + self.assertEqual(response["WWW-Authenticate"], "Token") normal_user = User.objects.create_user(username="normal_user") self.client.force_login(normal_user) response = self.client.get(self.ENDPOINT) diff --git a/src/paperless/auth.py b/src/paperless/auth.py index ac5b493b5..6857e1087 100644 --- a/src/paperless/auth.py +++ b/src/paperless/auth.py @@ -89,4 +89,5 @@ class PaperlessBasicAuthentication(authentication.BasicAuthentication): if auth_header.lower().startswith("basic "): return super().authenticate_header(request) - return None + # Still 401 for anonymous API access + return authentication.TokenAuthentication.keyword