Hi Experts,
When throwing BadRequestHttpException() in Yii2 Response has following fields
{
“name”: “Bad Request”,
“message”: “The Refresh Token is invalid”,
“code”: 0,
“status”: 400,
“type”: “yii\web\BadRequestHttpException”
}
This is OK. However we are integrating our system with one of Google Assistant Service and in case of invalid refresh token the expect “error” property with “Invalid_grant” in 400 response. I am struggling for last 3 days but unable to add additional property in Http response. I need to send response like below
{
“name”: “Bad Request”,
“error”: “invalid_grant”,
“message”: “The Refresh Token is invalid”,
“code”: 0,
“status”: 400,
“type”: “yii\web\BadRequestHttpException”
}
Tried multiple ways but not able to add additional filed “error” in the response. As a result automated test suite set by Google is failing for invalid refresh token (google documentation). Can you please guide me how to add additional filed.