djangorestframework-api-key
djangorestframework-api-key copied to clipboard
Misleading message when API key is expired
Describe the bug When api key is expired I get a 401 the response error message says "Authentication credentials were not provided". The tests in djangorestframework-api-key expect 403. Is there some configuration I can do?
To Reproduce Steps to reproduce the behavior:
- Add an API Key record and set expiration date to the future.
- Create an API which uses [HasApiKey]
- Call the API from client code with the key created in step 1. It will succeed.
- Modify the API key expiration date to be
- Call the API from client code again. As expected, it will fail, but with a status code of 403, error message is misleading: Authentication credentials were not provided. This is misleading, as the credentials were provided and does not match test results from djangorestframework-api-key.