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

OAuth2Authentication without DRF's BaseAuthentication inheritance #1403

Open
Zerotask opened this issue Feb 28, 2024 · 1 comment
Open

OAuth2Authentication without DRF's BaseAuthentication inheritance #1403

Zerotask opened this issue Feb 28, 2024 · 1 comment

Comments

@Zerotask
Copy link

Zerotask commented Feb 28, 2024

Is your feature request related to a problem? Please describe.
We are switching our REST API from DRF to ninja which worked pretty smoothly.
Now we want to remove DRF completely. Since we're using OAuth2Authentication we're getting an error because this inherits from a DRF class (from rest_framework.authentication import BaseAuthentication)

Describe the solution you'd like
either remove the inheritance (which just consists of 2 empty methods) or add a new neutral OAuth2Authentication class.

Describe alternatives you've considered
either we stay with the DRF dependency or we build our own OAuth2Authentication which doesn't inherit from DRF (preferred solution).

Since django-ninja is getting more ground lately, this is surely interesting for others as well.

Additional context
https://django-ninja.dev/guides/authentication/#http-bearer

@hartungstenio
Copy link

I'm not familiar with Django Ninja, but couldn't you use the Authentication Backend (OAuth2Backend) directly, instead of using the DRF integration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants