Authorization not working on production server

21 views
Skip to first unread message

Akash utreja

unread,
Dec 7, 2018, 11:21:51 AM12/7/18
to Django users
Hi,
I am building authorization in django framework using python.. The problem is that my code is working fine on local server but when I run the same in production it returns "Anonymous User" 

Am I doing it right?

if request.user.has_perm('auth.access_admin')
    ""whole code""
else:
   return Response({'error': 'Unauthorized'},
                        status=status.HTTP_401_UNAUTHORIZED)

My request.user.has_perm return false because request.user is Anonymous.I also try to return my request.user.username it is also coming blank.Please help me out!
Thanks
Akash

Sidnei Pereira

unread,
Dec 7, 2018, 1:59:58 PM12/7/18
to Django users
Did you log in?
Reply all
Reply to author
Forward
0 new messages