manosim / django-rest-framework-api-key

An extra layer of authentication for Web APIs made with Django REST Framework
BSD 2-Clause "Simplified" License
92 stars 30 forks source link

How do we generate api key and store it? Do we store the api in the settings file of our rest service app? #11

Open daxbritto opened 7 years ago

manosim commented 7 years ago

Hello @daxbritto! You can create a key from the django admin. Make sure you copy it before navigating to another page as it will not show up in the admin again to prevent from being reused.

image

daxbritto commented 7 years ago

Thanks so much! Another question to add on: Once we install the app will it mean all my Rest services for the apps will use the same api key? Is there a way where I can provide different client calling my service with different api keys?

manosim commented 7 years ago

So the idea is that if you have ie. a mobile app you will create an api key for this mobile app (attach the key to the headers of each request). If you you then build another service/app you will give that another key etc etc. This is used just for precaution so that no else will be able to make requests to your web api(imagine having a registration API endpoint open to everyone!). Hope it makes sense!

daxbritto commented 7 years ago

Hello @manosim it kinda makes sense. However the use case here is that we have multiple client talking to our 1 rest service app and we need separate api keys for each of them. Is this something possible to configure using this app?

manosim commented 7 years ago

So @daxbritto you could create multiple keys for each client and give them a name?

daxbritto commented 7 years ago

Thank u will try that...