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
I'm using Ninja to create an API endpoint in my Django project that needs to serve both GUI-based requests from my HTML template and programmatic requests (e.g., from Python). I want to achieve parity by using the same endpoint for both internal Django users and external users.
Here's my current setup:
apiR = NinjaAPI(csrf=True, auth=django_auth )
And my endpoint:
My goal is to have this endpoint behave differently depending on the request source:
When accessed from within Django (after authenticating via Django), no extra credentials should be required (hence the @login_required decorator).
When accessed programmatically (e.g., from Python), the same endpoint should require explicit authentication (e.g., username and password).
How can I achieve this dual authentication behavior with Ninja and Django?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi.
I'm using Ninja to create an API endpoint in my Django project that needs to serve both GUI-based requests from my HTML template and programmatic requests (e.g., from Python). I want to achieve parity by using the same endpoint for both internal Django users and external users.
Here's my current setup:
apiR = NinjaAPI(csrf=True, auth=django_auth )
And my endpoint:
My goal is to have this endpoint behave differently depending on the request source:
When accessed from within Django (after authenticating via Django), no extra credentials should be required (hence the @login_required decorator).
When accessed programmatically (e.g., from Python), the same endpoint should require explicit authentication (e.g., username and password).
How can I achieve this dual authentication behavior with Ninja and Django?
Thanks!
The text was updated successfully, but these errors were encountered: