How to modify builtin djoser status code response for login url?

I have created an authentication module in djoser using DRF for the user where user can log in and log out.

The Authentication module is working fine.

If the user enters wrong credentials it pops a builtin djoser error code of 400 Bad Request. Is there any way to change this error code from 400 Bad Request to 401 Unauthorized

from django.urls import path, include
from .views import *


urlpatterns = [
    path('api/auth/', include('djoser.urls')),
    path('api/auth/', include('djoser.urls.authtoken')),

I have not written any views for the djoser as it is giving me automatic url /api/auth/token/login for GET and POST requests.

Kindly if someone can guide me how i can modify the builtin djoser status code

Back to Top