How to define custom authentication response of REST services

0
Hi, all. I use custom authentication to protect the REST APIs. But I see we need to return the User Entity in the end. That’s reasonable, but I want to define the 401 response, something like: { "code":"401", "msg": "some parameter is missing" } rather than the default message: { "error": { "code": 401, "message": "You are not authorized to access this resource" } }  
asked
1 answers
0

I don't think you can change this message.

HTTP 401 is defined by w3c: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 

Afaik it is common practice not to explain anything to the outside world on why the authentication failed, so a possible hacker would not get any feedback on a hacking attempt.

If you really need this, you may want to contact mendix support for this.

answered