Skip to main content


To set up the base library, follow the following steps.

  1. Create a file in your app directory next to the and files. This file will hold your Ninja Extra API instance.

  2. Add the following lines of code to your
    from ninja_extra import NinjaExtraAPI
    from dj_ninja_auth.controller import NinjaAuthDefaultController

    api = NinjaExtraAPI()
  3. Add the following lines to your file
    from .api import api

    urlpatterns = [
    path("", api.urls)
  4. Add the following to your


This will give you 5 basic endpoints that are not secured and can be called by anyone. The endpoints are:

  • /auth/login
  • /auth/logout
  • /auth/password/reset/request
  • /auth/password/reset/confirm
  • /auth/password/change

Viola! You can start authenticating your users. To view and test the endpoints, you can visit http://localhost:8000/docs.


The NinjaAuthDefaultController sends back the data associated with the authenticated user but cannot keep track of a user's state. This means that beyond changing passwords and getting the user's data, the NinjaAuthDefaultController is functionally useless without at least session authentication using cookies.