-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
API authentication is not available when LOGIN_REQUIRED is true #724
Comments
Agreed this would be very helpful to document, the in-browser API works fine - but in a real world scenario CSRF tokens & cookies are unlikely to be used. Traditional HTTP auth doesn't appear to work for the API endpoints. |
I just dug into this a bit. Although basic HTTP authentication is supported by the REST API, NetBox implements a middleware which redirects all unauthenticated requests to the login page if I believe I've worked around this by exempting all API views from the redirection middleware, and instead enforcing Django REST Framework's built-in authentication when |
…TTP authentication when LOGIN_REQUIRED is true
Not quite, the middleware seems removed but auth isn't working - example:
The same error results for both incorrect and correct credentials. Possibly the DEFAULT_AUTHENTICATION_CLASSES need to be defined? |
It's working for me:
|
Works for me, the web server was restarted but not gunicorn - restarting both fixed the issue, thank you. |
…o enable basic HTTP authentication when LOGIN_REQUIRED is true
The REST API documentation is missing information on how to supply authentication credentials.
The text was updated successfully, but these errors were encountered: