django-ninja-jwt: error detail bad formatted
I’m using the router authentication
code: https://gist.github.com/pedrohsbarbosa99/8e42e54466ef62e0ba439d5177d99db7
OBS: using ninja.errors.ValidationError directly produce:
{
"detail": {
"email": "email is required"
}
}
When I call /pair, the exception, the ninja_jwt.ValidationError produce the following error:
{
"detail": "{'email': ErrorDetail(string='email is required', code='invalid')}"
}
Curl example:
curl -X 'POST' \
'http://127.0.0.1:8000/api/pair' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"password": "string"
}'
And ninja_jwt.AuthenticationFailed
{
"detail": "{'detail': ErrorDetail(string='Usuário e/ou senha incorreto(s)', code=''), 'code': ErrorDetail(string='', code='')}"
}
Curl example:
curl -X 'POST' \
'http://127.0.0.1:8000/api/pair' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"password": "wrong",
"email": "wrong"
}'
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 15 (9 by maintainers)
@eadwinCode Thank you for the solution.
I have one more question.
I think it could be interesting to add router base authentication into the project, something like:
If you want to lead with this question on other issue, let me know