-
Notifications
You must be signed in to change notification settings - Fork 51
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
Unauthorized 401 when loading the page #15
Comments
I have a similar issue: 403 (FORBIDDEN) on page load. Investigating. But advice would help... |
If you have incorporated it in your project, it may be the fault of $cookie which changed in angular js 1.4+ |
Also for Django Rest Framework ensure that TokenAuthentication is added to DEFAULT_AUTHENTICATION_CLASSES so that the Token HTTP request header gets accepted. This solved the issue for me. |
I have this exact same issue however my settings look more like this:
I am serving my WSGI application using Apache 2.2 on CentOS. My users can successfully log in and traverse the API endpoints that I have transplanted from this project (using the readme) however, if cookies are cleared, the first time I load the page it prompts me for username and password. Cancelling loads the page, but a request 401s in the console. I am trying to debug this myself, and will update if I have any significant findings. |
Turns out this is related to django-rest-auth using IsAuthenticated permission class for this particular API view. Changing the permission class to IsAuthenticatedOrReadOnly will result in no check or authentication, and 'authenticated' will for whatever reason then resolve to a truthy value. There is certainly a way to work around this with either a homebrewed django-rest-auth, or better logic in the JS. This should probably be closed as not a bug. |
Hi, implement angular-django-registration-auth but when I load the page a popup is displayed asking me for authentication and when I click cancel an error is displayed: http://127.0.0.1:8000/rest-auth/user Failed to load resource: the server responded with a status of 401 (UNAUTHORIZED)
I clear the cookies and It still is displayed. In django settings REST_FRAMEWORK I have:
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' (here I tried with anothers like AllowAny, IsAuthenticatedOrReadOnly and DjangoModelPermissions with all of them I get the same result)
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.BaseicAuthentication',
'rest_framework.authentication.SessionAuthentication'
]
Is it an issue? or have I something wrong?
please advise
The text was updated successfully, but these errors were encountered: