4.7.0-RC.1 causes 401 response in acralyzer
Sending request to http://my.server.net:5984/acra-wayaway/_design/acra-storage/_update/report/2e797c09-69cf-4675-b278-7918539827ad Request response : 401 : Unauthorized Failed to send crash report for 1443825776737-approved.stacktrace org.acra.sender.ReportSenderException: Error while sending JSON report via Http PUT at org.acra.sender.HttpSender.send(HttpSender.java:248) at org.acra.SendWorker.sendCrashReport(SendWorker.java:181) at org.acra.SendWorker.checkAndSendReports(SendWorker.java:140) at org.acra.SendWorker.run(SendWorker.java:76) Caused by: java.io.IOException: Host returned error code 401 at org.acra.util.HttpRequest.send(HttpRequest.java:148) at org.acra.sender.HttpSender.send(HttpSender.java:245) at org.acra.SendWorker.sendCrashReport(SendWorker.java:181) at org.acra.SendWorker.checkAndSendReports(SendWorker.java:140) at org.acra.SendWorker.run(SendWorker.java:76)
The CouchDB log:
[Fri, 02 Oct 2015 22:45:43 GMT] [info] [<0.9988.0>]
But if I roll back to version 4.6.2, all works fine (200 etc).
I'm guessing the credentials aren't sent correctly.
I have same error with 4.7.0-RC.1
I saw raw http request 4.6.2 send auth header Authorization : Basic...... 4.7.0-RC.1 doesn't send auth header
Hi. yes I'm getting this error too! 401, {"error":"unauthorized","reason":"You are not authorized to access this db."} *username or password has not been changed and version 4.6.2 works normally. please fix it
Thanks for the feedback guys, but I'm snowed under and am not going to get to this in the next week or two. Anyone else want to jump in?
I think problem is in:
"I'm using URLConnection to connect to the main server. The server implements digest authentication. If I connect to the server with java library, the connection is successful. But if I use the same code for android, the connection is rejected for the reason - username and password do not match."
https://code.google.com/p/android/issues/detail?id=9579 http://stackoverflow.com/questions/3197814/urlconnection-working-with-java-code-but-not-for-android-use-in-digest-authent
HttpRequest -> send ->
As a temporary solution i changed code:
if ((login != null) && (password != null)) {
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(login, password.toCharArray());
}
});
}
to code:
if ((login != null) && (password != null)) {
String encoded = Base64.encodeToString((login + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP);
urlConnection.setRequestProperty("Authorization", "Basic " + encoded);
}
But be careful, Base64.encodeToString work only from Android API 8.
Use a home-grown implementation instead: http://androidcodemonkey.blogspot.com/2010/03/how-to-base64-encode-decode-android.html if need Base64 in android below API 8.
Thanks @mdenissov