Questions tagged [django-rest-knox]
45 questions
6
votes
2 answers
Django to return a view with TokenAuthentication for WebView
I am trying to create a flutter app which will use webview to display authenticated data from my Django App.
Steps Involved:
Flutter app sends authentication request
Django validates the user credentials (user id & Password) and returns…

stackoverflow rohit
- 185
- 4
- 13
4
votes
2 answers
How do you authenticate a websocket connection with Knox token authentication on django channels?
I understand you can write custom authentication middleware to use in django channels 2.
This works fine with Django's built-in token authentication but using django-rest-knox tokens is a different story.
Knox stores its tokens in an encrypted form…

Brian Min
- 265
- 4
- 10
2
votes
1 answer
What is the use of token return after login or registration from django-rest-knox?
Hy there,
I work on project where I used django-rest-knox for token authentication. I have doubt that
1.How token be used that has return while registering and login.
(
when i pass token in postman as like,
in header section
Authentication Token…

BHUWAN PANDEY
- 43
- 6
2
votes
2 answers
Get user object from token string in DRF Token In Django using Knox Token
I have question related with Django .
I am using Knox Token Authentication to generate tokens for every user when he log in on the page.
Now I want to use that token for every request that will send so I can get the corresponding user for the token.…

m4rtin
- 31
- 1
- 3
2
votes
0 answers
Sending http only cookie in Authorization header django-rest-framework
I'm building a rest API using django-rest-framework with auth implementation with django-rest-knox and I want to store the token in an http only cookie with a React frontend. So I've used thie code:
from django.contrib.auth import login
from…

Fady's Cube
- 158
- 1
- 7
2
votes
1 answer
Django Knox-Rest Authentication Receives 500 Error on Login
I'm working on setting up a Django knox-rest framework for my rest api. I'm using Postman to test the login and after executing the request, my API returns a 500 error along with a stack dump. The dump returned to Postman is showing me the…

Gary Franks
- 103
- 4
2
votes
1 answer
Django-rest-framework {"detail": "Authentication credentials were not provided." } using django-rest-knox
I see the error {"detail": "Authentication credentials were not provided." }.
This is the code I am using for Login
My Model:
class User(AbstractBaseUser):
STUDENT = 'STU'
SCHOOL = 'SCH'
INSTITUTE = 'INST'
TUTOR = 'TUT'
…

RAHUL RANJAN
- 21
- 2
2
votes
3 answers
How do you log in when using django-rest-knox?
Django-Rest-Knox provides a view to give you the token to authenticate, but that view requires authentication:
https://github.com/James1345/django-rest-knox/blob/05f218f1922999d1be76753076cf8af78f134e02/knox/views.py#L16
How is this intended to be…

Pablo Fernandez
- 279,434
- 135
- 377
- 622
1
vote
0 answers
Expired tokens are not deleted after expiration in django-rest-knox 4.1.0
I am using django-rest-knox 4.1.0 . In its documentation it says that expired tokens are deleted automatically. But it is not deleting the tokens.
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": (
…

fazilajafarli
- 11
- 3
1
vote
1 answer
How to refresh token after expiry in django knox authentication?
I am running django application with django knox token authentication. I was able to do login with the package.
But after the token expired, url response are throwing " Invalid Token".
I don't understand how to refresh the token after expiry?…

mcv
- 45
- 2
- 10
1
vote
1 answer
How do I access User Model field in the Serializer of extended User Model in Django Rest Framework?
I am creating a simple registration/login app in Django Rest Framework using Rest APIs with Django Rest Knox's authentication, in which, upon registration, user will also upload a CSV File (which is an optional field).
I have a Person Model which is…

Neha AK
- 67
- 1
- 10
1
vote
1 answer
Pytest login view with knox authentication
I am using knox token in authentication so Here's my Signup and Signin view, How to test the signing view with APIRequestFactory
class SignUpAPI(generics.GenericAPIView):
serializer_class = RegisterSerializer
def post(self, request, *args,…

Menna Magdy
- 355
- 1
- 2
- 14
1
vote
1 answer
permission.AllowAny not working in knoxLoginView
I tried using the knoxLoginView for login with token authentication,and it was stated on knox documentation that for the loginView to work and not throw a 401 unauthorized error i have to either add permission class "AllowAny" or override the…

hakeem2000
- 21
- 2
1
vote
0 answers
Can't login with Django Knox using Fetch POST request
I'm trying to login from the react front end via a Fetch POST request to the Knox endpoint but I am unable to. I can login normally from http://localhost:8000/api/login/ so I assume something must be wrong with my fetch but I can't figure it out. On…

user17817249
- 83
- 7
1
vote
2 answers
Could not import 'knox.auth.TokenAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'
I'm new to Django rest and I'm trying to create a very simple application that allows user to login/sign-up using knox. But as I try to run commands like "python manage.py makmigrations" or any other Django related commands, I get this…

Masih Bahmani
- 153
- 2
- 10