I have recently started using Django ninja for REST API.I found it extremely easy but for the authentication flow. I just can't understand what exactly I can do for the following.Create a registration API which registers a user with email address, password and full name (later I may add other stuff ).Send username and password to a view with the url api/login and then get a jwt token. Note that just one jwt token is sufficient for now, so pair is not necessary.Now protect a few important views and only allow access if the token is valid.I understand that @router.get, post etc will have one injection of this middleware.But I can't get a simple tutorial or article that tells me exactly what I need to do.Every one has some different approach, some using framework_simplejwt and some doing it with ninja-extra. I just need a plain simple flow. So any help would be appreciated.I understand that I need to extent the django user class and also I understand router and api objects.All I need is that I create token using the secret key and issue it on login and then check it on every subsequent request.
↧