forked from jazzband/djangorestframework-simplejwt
    
        
        - 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 30
 
Open
Description
I couldn't create a pull request for the issue due to limited time but it seems like built-in AuthenticationFailed exception class has an inheritance order issue.
https://github.com/eadwinCode/django-ninja-jwt/blob/master/ninja_jwt/exceptions.py#L35
This class doesn't get default_code attribute from  AuthenticationFailed exception, instead it gets from DetailDictMixin class which is empty string.
my implementation:
@api_controller("/auth", tags=["auth"])
class UserTokenController(TokenObtainSlidingController):
    auto_import = True
    @route.post("/login", response=UserTokenOutSchema, url_name="login")
    def obtain_token(self, user_token: jwt_schemas.TokenObtainSlidingInputSchema):
        user = user_token._user
        token = SlidingToken.for_user(user)
        return UserTokenOutSchema(
            user=user,
            token=str(token),
            token_exp_date=datetime.fromtimestamp(token["exp"], tz=timezone.utc),
        ){
  "detail": "No active account found with the given credentials",
  "code": ""
}
Thanks
Metadata
Metadata
Assignees
Labels
No labels