You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation https://django-ninja.dev/guides/authentication/ suggests setting auth=GlobalAuth() on NinjaAPI initialization for having authentication setting across endpoints without issuing it separately for every time.
Copying the example code here:
from ninja import NinjaAPI, Form
from ninja.security import HttpBearer
class GlobalAuth(HttpBearer):
def authenticate(self, request, token):
if token == "supersecret":
return token
api = NinjaAPI(auth=GlobalAuth())
I couldn't find a way to do this while using the ninja helper which initializes NinjaAPI without parameters at:
Not sure about the implications supporting this would have but for now I'll leave the helper for a moment and try import django-ninja directly (as mentioned in nanodjango docs).
The text was updated successfully, but these errors were encountered:
Documentation https://django-ninja.dev/guides/authentication/ suggests setting
auth=GlobalAuth()
onNinjaAPI
initialization for having authentication setting across endpoints without issuing it separately for every time.Copying the example code here:
I couldn't find a way to do this while using the ninja helper which initializes
NinjaAPI
without parameters at:nanodjango/nanodjango/app.py
Line 300 in 612abf5
Not sure about the implications supporting this would have but for now I'll leave the helper for a moment and try import
django-ninja
directly (as mentioned in nanodjango docs).The text was updated successfully, but these errors were encountered: