Re: 401 unauthorized while using django token authentication system

2018-12-12 Thread Wanderley S
Hello, No. You can set this "globally" in settings and then overight as needed in views (CBV, FBV) Actually, for secutrity matters, is a best practice to do exactly like this: First you close you API access in settings, by allowing access to administrators only, then, on each class or function yo

Re: 401 unauthorized while using django token authentication system

2018-12-11 Thread Akash utreja
Thanks for reply. I will check this. On Tuesday, December 11, 2018 at 3:09:11 PM UTC+5:30, Arbaz Hundekar wrote: > > Check if your response is getting cached. > > On Tue, Dec 11, 2018 at 4:03 AM Wanderley S > wrote: > >> Hi, did you add permission_classes in your view or in your settings? If >>

Re: 401 unauthorized while using django token authentication system

2018-12-11 Thread Akash utreja
Thanks for reply. It is same in each run. On Tuesday, December 11, 2018 at 1:49:00 AM UTC+5:30, CJ Keeney wrote: > > I believe if your SECRET_KEY setting is different between runs, the token > would need to be recreated. > > On Mon, Dec 10, 2018 at 5:33 AM Akash utreja > wrote: > >> Hi, I am us

Re: 401 unauthorized while using django token authentication system

2018-12-11 Thread Akash utreja
Hi thanks for reply. Is it mandatory to put permission classes in each class? and what about functional views? On Tuesday, December 11, 2018 at 4:03:32 AM UTC+5:30, Wandss wrote: > > Hi, did you add permission_classes in your view or in your settings? If > not I believe you sholud do something

Re: 401 unauthorized while using django token authentication system

2018-12-11 Thread Arbaz Hundekar
Check if your response is getting cached. On Tue, Dec 11, 2018 at 4:03 AM Wanderley S wrote: > Hi, did you add permission_classes in your view or in your settings? If > not I believe you sholud do something like: > In your .views file: > > from rest_framework.permissions import IsAuthenticated >

Re: 401 unauthorized while using django token authentication system

2018-12-10 Thread Wanderley S
Hi, did you add permission_classes in your view or in your settings? If not I believe you sholud do something like: In your .views file: from rest_framework.permissions import IsAuthenticated Then inside your class: Class SomeAPIView(APIView): permission_classes = (IsAuthenticated,) the

Re: 401 unauthorized while using django token authentication system

2018-12-10 Thread CJ Keeney
I believe if your SECRET_KEY setting is different between runs, the token would need to be recreated. On Mon, Dec 10, 2018 at 5:33 AM Akash utreja wrote: > Hi, I am using built in token authentication of django but I am getting > weird error that some of my request got 200 and some of then got 4

401 unauthorized while using django token authentication system

2018-12-10 Thread Akash utreja
Hi, I am using built in token authentication of django but I am getting weird error that some of my request got 200 and some of then got 401 unauthorized when I run it on server same with localhost. Both request have same token value I've checked multiple times.Can anyone tell what is thing i