Questions tagged [django-rest-knox]
45 questions
1
vote
1 answer
Getting "AuthToken.user" must be a "User" instance. in django-rest-knox
I am creating a login method using Django-rest-Knox. I have created a custom user in app using AbstractBaseUser.
This is my views.py
class LoginView(GenericAPIView):
serializer_class = LoginSerializer
def post(self, request, *args,…

SahilM
- 118
- 2
- 13
1
vote
1 answer
Using http only cookie to store auth token django-rest-framework
I'm building a rest API with auth implementation using Django-rest-framework and Django-rest-knox, And in the front-end I'm using React.js. I want to store the auth token securely in the front-end and I know that the best way to do it is using…

Fady's Cube
- 158
- 1
- 7
1
vote
2 answers
When I log out, I find this error "detail": "Authentication credentials were not provided."
I am using django-rest-knox, when I logout using knox_views.LogoutAllView.as_view(), it gives me this error:
"detail": "Authentication credentials were not provided."
Note: I am using a custom user model(AbstarctUser and BaseUserManager)
Here is…

Menna T-Allah Magdy
- 27
- 7
1
vote
1 answer
DRF and Knox showing logged in user as anonymous (Django)
I created an API with DRF and Knox and, I am using token based authentication. Everything is working except the system is showing the logged in user as anonymous.
I tried all this:
current_user = request.user
…

AJNagz
- 11
- 2
1
vote
1 answer
Django REST Knox Authentication Issues
I've completed the development work on a Django REST API using Knox-Rest. It works great in my development environment but after moving it to the Prod environment, it authenticates users and returns a token back. Then using Postman, to test the…

Gary Franks
- 103
- 4
1
vote
3 answers
How can I extend expiry time of Knox-Token
I haven't changed the settings of Knox in my Django app. The default expiry time is 10hours, how can I change this that it won't expiry.
1
vote
1 answer
django-rest-knox in production: "TypeError: create() takes 1 positional argument but 2 were given"
I am doing token authentication with Knox. It has worked perfectly through development, but now that I try to deploy on PythonAnywhere, I get the error in the title: "TypeError: create() takes 1 positional argument but 2 were given".
This is the…

oqukeun
- 31
- 1
- 4
1
vote
2 answers
django rest framework problems with passing the header
I'm trying to pass the token to the backend but I'm having some issues.
when I'm writing this in the cmd:
curl -H "Authorization: Token 3c9c6079602737a04fcb6b2e737804142ef93930e4e705c0598b2fc597759f7f" http://127.0.0.1:8000/api/auth/user/
I get…

Circus4
- 301
- 2
- 5
- 13
1
vote
1 answer
Django Rest Framework APIView not CSFR Exempt
Making a POST requests to register a new user through postman returns 403 Forbidden, CSRF verification failed. Request aborted... Going by DRF documentation and knox auth documentation i have everything set up correctly. It appears that Django's…

SemajDraw
- 131
- 10
1
vote
1 answer
Django restframework, Authentication credentials were not provided, knox-tokenauthentication
I took a tutorial in Redox and Django from youtube from Traversy Media.
I follow along with the tutorial and now I don't know were it curshed.
curl http://localhost:8000/api/auth/login/ -d \
'{"username": "Tom", "password": "PassWord@321"}' \
-H…

Atom
- 320
- 1
- 6
- 14
1
vote
1 answer
Is knox token is safe are not?
I'm using Drf(django rest framework) for my back end development. I tried to use Knox-token for authentication and token generation. I new to this knox-token. I need to know is Knox token is safe are not?.
I'm going to develop web based product. So…

Adhiyaman Infotech
- 31
- 4
1
vote
2 answers
How to force logout when Knox created token has expired?
I developed my Django based webapp with token authentication by following this tutorial of Brad Traversy (https://www.youtube.com/watch?v=0d7cIfiydAc) using Knox for authentication and React/Redux for the frontend. Login/logout works fine (here is…

Greg Holst
- 874
- 10
- 23
0
votes
0 answers
Why does my login endpoint in django knox throw "Bad request..." error?
I used files from "https://github.com/Omkar0231/Django-Login-API" with as is. The login request from Postman is resulting in error, "detail": "JSON parse error - Expecting value: line 1 column 1 (char 0)", while the terminal shows "Bad…
0
votes
0 answers
django-rest-knox - how to authenticate token for email verification?
I am trying to set-up email verification using django-rest-knox. The link is being sent out. When I use the following:
from knox.auth import TokenAuthentication
class VerifyEmailAPI(generics.GenericAPIView):
def get(self, request):
#…

Sid
- 3,749
- 7
- 29
- 62
0
votes
0 answers
How to validate a token in Django Knox Authentication
I am using knox authentication to login user after validating otp using the view below
class LoginPhoneApi(KnoxLoginView):
permission_classes = (permissions.AllowAny,)
def post(self,request,formt=None):
serializer =…

stackoverflow rohit
- 185
- 4
- 13