'How to create an API secured by api key
I'm trying to create a RESTful API using django-rest-framework and I'm unable to secure it with access key, How can I go about it?
Solution 1:[1]
You can use JWT Authentication to achieve that.
Solution 2:[2]
Depending on your needs, you can use built-in Django Rest Framework token authentication, as stated here, this will create non-expiring tokens in database that can be used as API keys in your case. However, if you don't want to store them at database and set your custom expiration periods for your tokens, I suggest you using simplejwt library for Django Rest Framework
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PleSo |
| Solution 2 | Ersain |
