Questions tagged [django-rest-framework-simplejwt]

Simple JWT provides a JSON Web Token authentication backend for the Django REST Framework. It aims to provide an out-of-the-box solution for JWT authentication which avoids some of the common pitfalls of the JWT specification.

352 questions
16
votes
9 answers

Django drf simple-jwt authentication"detail": "No active account found with the given credentials"

I am implementing user authentication with django-rest_framework_simple-jwt with custom user, My models.py: class UserManager(BaseUserManager): def create_user(self, email, username, password, alias=None): user = self.model( …
13
votes
2 answers

Django Channels JWT Authentication

I'm trying to access the user in the scope in my Consumer.py and grab some user related models from the DB. However, it seems like AuthMiddlewareStack I'm using for authenticating all the websocket connections is not working correctly. What is the…
13
votes
2 answers

Simple JWT add extra field to payload data in token

I use djoser and rest_framework_simplejwt. This my user model; class userProfile(models.Model): user=models.OneToOneField(User,on_delete=models.CASCADE,related_name="profile") date_joined=models.DateTimeField(auto_now_add=True) …
uyarc
  • 579
  • 4
  • 17
12
votes
3 answers

It is required that you pass in a value for the "algorithms" argument when calling decode()

The following pages are the code of projects: If i am using token = jwt.encode(payload,'secret', algorithm='HS256').decode('utf-8') statement then 'str' object has no attribute 'decode' error is occuring. Also, when I am removing and using it…
9
votes
3 answers

How to store JWT tokens in HttpOnly cookies with DRF djangorestframework-simplejwt package?

I've been using djangorestframework-simplejwt for a while and now I want to store the JWT in the cookies (instead of localstorage or front-end states) so that every request that the client makes, contains the token. So did some research on it and…
9
votes
4 answers

Getting user details from access token in Django rest framework -simple JWT

I am using React and Django rest framework for a project. I use Django rest framework simple JWT for authentication. Now, I want to display the username in the navbar after the user logs in. So, is there a way in simple JWT for returning user…
9
votes
4 answers

How to decode and verify simple-jwt-django-rest-framework token

i am trying to verify and decode simple-jwt-django-rest-framework token. I know we can use verify api of simple-jwt. But i want to decode and verify in my views . Below is the current code i am trying:- //in views.py class home(APIView): def…
9
votes
3 answers

Adding claims to DRF simple JWT payload

Using djangorestframework_simplejwt library, when POST to a custom view #urls.py path('api/token/', MyTokenObtainPairView.as_view(), name='token_obtain'), #views.py class MyTokenObtainPairView(TokenObtainPairView): serializer_class =…
9
votes
1 answer

Django Rest Framework - Using Session and Token Auth

I am trying to get this working but don't know if this is possible. It should be doing it like this. I developed a web app using Django + Rest-Framework + jQuery, and I want to have an external application to consume the same REST API, using JWT…
8
votes
1 answer

Django Rest Framework app security preparation for production (Auth and Admin Panel)

Intro I've built a web application with multiple services: frontend (react) backend (API and admin panel) (Django Rest Framework + simple jwt auth) Redis, DB, Nginx and etc Kubernetes cluster The app isn't small like 60k+ lines of code. It's a…
8
votes
4 answers

Django Rest Framework avoid authentication JWT

I am using rest_framework_simplejwt to authenticate my users but, in some views i need to ignore it, because these are public views. i want to check the token into view flow. The expected behaviour is: In public view Avoid token validation: If is…
7
votes
4 answers

ModuleNotFoundError: No module named 'rest_framework_simplejwt.token_blacklistauthentication'

I am experiencing this error caused by the simplejwt framework. ModuleNotFoundError: No module named 'rest_framework_simplejwt.token_blacklistauthentication' I want to blacklist used refresh tokens (after refresh). The simplejwt works perfectly but…
7
votes
1 answer

Is one authentication method more secure for a Django DRF backend?

I want to use the most secure method to store my logged in users session in a cookie. the backend is built on Django & DRF, so I'm choosing between the simplejwt plugin for token auth or djangos default SessionAuth. the frontend isnt SPA, but will…
7
votes
1 answer

Implement djangorestframework-simplejwt token authentication without password

My app does not require password as I want to login with phone and OTP. I'm trying to implement custom simple JWT token authentication which takes only a phone number and no passwords. I'm new to Django and I did check some links in stackoverflow…
7
votes
3 answers

remove authentication and permission for specific url path

I'm working with DRF and came across this issue. I have a third-party view which I'm importing in my urls.py file like this : from some_package import some_view urlpatterns = [ path('view/',some_view) ] but the issue I'm facing is since I have…
1
2 3
23 24