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

REST implementation of the Django authentication #26

Closed
laith43d opened this issue Oct 8, 2020 · 8 comments
Closed

REST implementation of the Django authentication #26

laith43d opened this issue Oct 8, 2020 · 8 comments
Labels

Comments

@laith43d
Copy link

laith43d commented Oct 8, 2020

Hi,

This is not an issue, but rather a proposal.

I came by Django-Ninja a few days ago while surfing the Internet. This is beyond great, I would love to contribute.

An essential feature IMHO is to develop a REST implementation of the Django authentication system with Ninja instead of DRF. I have used Djoser before, which exactly that but implemented with DRF.

Is that in your plans? What can I do to help?

@vitalik
Copy link
Owner

vitalik commented Oct 8, 2020

Hi @laith43d
Thank you for trying django-ninnja

Well I thought about this, and I think this best lands into a separate plug-able app

you can basically implement a a router in external python package like:

# mydjoser/router.py
from ninja import Router


router = Router()

@api.get("/users/"):
def users(request):
   ...
@api.get("/users/me/"):
def me(request):
   ...

.. and so on...

and then it can be plugged to any app like:

api = NinjaAPI()

api.add_router("", mydjoser.router.router)

@laith43d
Copy link
Author

Thanks, @vitalik

I have already started working on it, however, I have one last question, is Django-Ninja considered production-ready (in terms of stability), have you tested it in a production environment?

I am asking so I can convince my colleagues comfortably.

@vitalik
Copy link
Owner

vitalik commented Oct 13, 2020

Hi @laith43d
Yes, Django Ninja is used in multiple production applications already
(in fact a lot of security already done on Django core side)

@vitalik vitalik added the plugin label Oct 19, 2020
@budlight
Copy link

@vitalik Are you aware of any currently active extensions to django-ninja? I feel like authentication is a super obvious one. I am writing my own for one time passwords right now and wouldn't mind structuring it in such a way to maybe make it part of a larger project in the future.

@vitalik
Copy link
Owner

vitalik commented Feb 19, 2021

Hi @budlight
no, currently I'm not aware of wide used public plugins

so if you have something to share let me know

@femiir
Copy link

femiir commented Jun 18, 2023

Hi @laith43d Thank you for trying django-ninnja

Well I thought about this, and I think this best lands into a separate plug-able app

you can basically implement a a router in external python package like:

# mydjoser/router.py
from ninja import Router


router = Router()

@api.get("/users/"):
def users(request):
   ...
@api.get("/users/me/"):
def me(request):
   ...

.. and so on...

and then it can be plugged to any app like:

api = NinjaAPI()

api.add_router("", mydjoser.router.router)

are you saying directly djoser will not work or I pip install djoser then write a router to all djosers endpoints

@baseplate-admin
Copy link
Contributor

are you saying directly djoser will not work

Yes djoser will not work automatically ( as far as i know )

I pip install djoser then write a router to all djosers endpoints

Yes you have to do this if you want to use djoser

@femiir
Copy link

femiir commented Jun 19, 2023

well I will just write my logic once and always use it...as a boiler template for future projects as I always end up inheriting and customising things in def always

@vitalik vitalik closed this as completed Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants