D
D
Dilik Pulatov2018-02-02 15:05:58
Yii
Dilik Pulatov, 2018-02-02 15:05:58

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"
}

is it possible to modify this answer and make my own answer? and how is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
enchikiben, 2018-02-02
@EnChikiben

override the authorization class that you use and rewrite the method in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question