Skip to content

OAuth

OAuth integration is not bundled as a first-class module in this package.

Use Django authentication providers and Ninja auth hooks, then map authorization failures to JSON:API error responses.

Example pattern

from django_ninja_jsonapi import NinjaJsonAPI
from ninja.security import HttpBearer


class OAuthBearer(HttpBearer):
    def authenticate(self, request, token):
        if not token:
            return None
        return {"token": token}


api = NinjaJsonAPI(auth=OAuthBearer())

Future docs may include end-to-end examples with common Django OAuth providers.