Android Get Token Status: 401 Unauthorized /Suggestion: More comprehensive error messages

I have been trying to include FreeAgent connection in an Android App for 4
days now. Every time something fails, I need a lot of trail and error to
find what is wrong.

For example if I try to authorise an app and an error occurred, I always
see a failure in the login when the cause can be something else. Another
problem is when I try to get a token I always get an “Unauthorised” with no
more information. This Unauthorised may be cause by a lot of different
factors. It is infuriating to do trial and error specially when suff works
on a REST Client and doesn’t work on Android with the exact same values.

Can you please include a message with more detail regarding the error in
the Response?

So far I was able to do the login, get the code and now I am stuck at
trying to get the token.
This is my request and response.

Accept: application/json
Authorization: Basic
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: 128
—> END HTTP (128-byte body)
<— HTTP 401 (361ms)
Server: nginx
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 401 Unauthorized
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
WWW-Authenticate: Basic realm=“Application”
Cache-Control: no-cache
X-Request-Id: 914ffac0-a6e1-4992-beea-f86d91e11dd3
X-Rev: 38aa63
X-Host: web4-ash
X-Runtime: 0.152258
Vary: Origin
Set-Cookie: uid=1YFNslZm7be0BQhUMhznAg==; expires=Wed, 07-Dec-16 14:48:23
GMT;; path=/
OkHttp-Selected-Protocol: http/1.1
OkHttp-Sent-Millis: 1449586103272
OkHttp-Received-Millis: 1449586103468
HTTP Basic: Access denied.
<— END HTTP (27-byte body)

Best Regards
Pedro Laranjeiro