Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Combining JWTAuth with django_auth only works in that order #1125

Open
bastiaan85 opened this issue Apr 10, 2024 · 0 comments
Open

[BUG] Combining JWTAuth with django_auth only works in that order #1125

bastiaan85 opened this issue Apr 10, 2024 · 0 comments

Comments

@bastiaan85
Copy link

Describe the bug
When combining JWTAuth from django-jwt-auth with django_auth, if the latter precedes the former in the auth=[] parameter, calls using Bearer auth fail on "detail: CSRF check Failed". When inverting the order, both work.

    api = NinjaExtraAPI(
    title="My API",
    csrf=False,
    docs=Swagger(),
    docs_decorator=login_required,
    docs_url="/swagger",
    auth=[JWTAuth(), django_auth],  # working
    renderer=ORJSONRenderer(),
    urls_namespace="api",
)

while auth= [django_auth,JWTAuth()] generates the csrf error.

Versions (please complete the following information):

  • Python version: 3.12.2
  • Django version: 5.0.4
  • Django-Ninja version: 1.1.0
  • Django-Ninja-JWT version: 5.3.0
  • Pydantic version: 2.64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant