9👍
IsAuthenticated
is a Permission Class
not an Authentication
class. So it should be as
class AccountInfoUpdate(APIView):
permission_classes = [IsAuthenticated]
# your code
UPDATE-1
How to resolve CSRF Failed
error
1. Open a new tab in POSTMAN
2. Provide URL(1)
3. Go to Authorization
tab(2) and setect Basic Auth
then provide your username and password
4. Then go to Body
tab, and enter your JSON payload.
5. Hit send
button. There you go
1👍
I was also getting this error "rest_framework.request.WrappedAttributeError: ‘IsAuthenticated’ object has no attribute ‘authenticate’" error in following manner:
my login code was having:
def post(self, request,):
username = request.data.get("username")
password = request.data.get("password")
user = authenticate(username=username, password=password)
While i was getting error, REST_FRAMEWORK contained following in settings.py:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
}
Later i added following also and my error was gone:
REST_FRAMEWORK = {
......
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
)
}
You can try and give feedback please.
- [Django]-How to get Django QuerySet 'exclude' to work right?
- [Django]-How to make a geography field unique?
0👍
"CSRF Failed: CSRF token missing or incorrect."
problem is solved by front end site but still its not working in postman side. Anyway, my problem is solved frond-end side by this link after long RND.
- [Django]-Django MEDIA_URL returns http instead of https
- [Django]-NoReverseMatch in django production server
- [Django]-Django – How can I set/change the verbose name of Djangos User-Model attributes?
- [Django]-Installing a Module on Heroku
- [Django]-Convert all CharField Form Field inputs to lowercase in Django forms