Answer the question
In order to leave comments, you need to log in
Is it possible to change the response of the Yii2 framework API?
Hello!
when the user is not authorized, the API will return such a response
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials.",
"code": 0,
"status": 401,
"type": "yii\\web\\UnauthorizedHttpException"
}
Answer the question
In order to leave comments, you need to log in
override the authorization class that you use and rewrite the method in it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question