florimondmanca / djangorestframework-api-key

🔐 API key permissions for Django REST Framework
https://florimondmanca.github.io/djangorestframework-api-key/
MIT License
678 stars 104 forks source link

Getting 'Authentication credentials were not provided' in test project #217

Closed marcosgeorgopoulos closed 2 years ago

marcosgeorgopoulos commented 2 years ago

Describe the bug

I have been trying to get your library working with my own Django project for a while, but was always getting the 'Authentication credentials were not provided' message.

So I tried using your test project assuming something is wrong with my code but I am getting the same behaviour still.

To Reproduce Steps to reproduce the behavior:

Download test project from this repo 1.Create a venv and install supports library versions

  1. migrate 3.create a super user 4.log into Django admin and create an API key.
  2. Run the following code.

import requests response = requests.get('http://127.0.0.1:8000/api/protected/object/', headers={'Authorization':'Api-Key fQozkhS6.iZ3h0Yi3epnYHkPkKuS5rWtxMY4HjH9w'}) print(response.json())



**Expected behavior**
I expected to get a "hello world" response

**Desktop (please complete the following information):**
 - OS: MacOS
- Python Version: Python 3.8
 - Django Version: 3.2
 - DRF Version: 3.13.1

**Additional context**
I'm not sure if this is a  BUG or if I am just passing the API Key incorrectly?