Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an API #35

Open
TeoGoddet opened this issue Apr 29, 2020 · 1 comment
Open

Provide an API #35

TeoGoddet opened this issue Apr 29, 2020 · 1 comment

Comments

@TeoGoddet
Copy link
Contributor

TeoGoddet commented Apr 29, 2020

It would be nice to provide an API.

One exists for member management and should not be missed and may be used as example : https://github.com/ArcaniteSolutions/truffe2/blob/master/truffe2/members/views.py

Steps would be the following :
- Create an a view to create jwt api tokens
- Create an api auth backend for api that could check validity of JWT when receiving request
- Create Generic CRUD serializerers (if possible)
We may use this https://www.django-rest-framework.org/tutorial/1-serialization/#using-modelserializers (code should look like https://github.com/ArcaniteSolutions/truffe2/blob/master/truffe2/generic/forms.py)
- An then create the required views using the serializers (code should look like https://github.com/ArcaniteSolutions/truffe2/blob/master/truffe2/generic/views.py)
- Dont forget the urls
(https://github.com/ArcaniteSolutions/truffe2/blob/master/truffe2/generic/views.py)

if too complicated, still possible to create individual views

@zyuiop
Copy link

zyuiop commented Apr 29, 2020

Re. JWT, you should be careful as they cannot be revoked. I'd rather advocate for a model representing an APP and its associated random generated API key. Revocating a key would simply mean changing the key for the app, and checking for an API key would be a simple request to the SQL database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants