Closed alexdiostia closed 5 years ago
Do you have more details about the error? Have you tried to enable preemptive authentication? You can enable it with this method: https://github.com/thegrizzlylabs/sardine-android/blob/master/src/main/java/com/thegrizzlylabs/sardineandroid/impl/OkHttpSardine.java#L81
If that doesn't help, could you share an example of URL/login/password so that I can reproduce the problem and try to fix it?
Do you have more details about the error? Have you tried to enable preemptive authentication? You can enable it with this method: https://github.com/thegrizzlylabs/sardine-android/blob/master/src/main/java/com/thegrizzlylabs/sardineandroid/impl/OkHttpSardine.java#L81
If that doesn't help, could you share an example of URL/login/password so that I can reproduce the problem and try to fix it?
Hello i have the same authentication failure with, or without preemptive auth.
when reaching the list() function call, i get : I/System.out: Authenticating for response: Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://mydomain.net/webdav/} I/System.out: Challenges: [Digest realm="webdav" charset="ISO-8859-1"]
i am certain URL,login,password are ok (i only replaced here my own domain by "mydomain", the rest is the same) thanks alex
This library only supports Basic auth now, so if you are using Digest auth, it will fail to sign in and throw the 401 failure.
You can try the okhttp-digest to instead of the inner Basic auth of our sardine-android.
ok, Thanks Drakeet! That explains why indeed... i'm using Digest. Ideally, the authentication should be successful whatever auth type. I may prefer waiting that you integrate it in the project :)
thanks again! i included the lib , and the following in the setCredentials()... that seems to work fine
final Map<String, CachingAuthenticator> authCache = new ConcurrentHashMap<>(); final DigestAuthenticator authenticator = new DigestAuthenticator(new com.burgstaller.okhttp.digest.Credentials(username, password)); builder.authenticator(new CachingAuthenticatorDecorator(authenticator, authCache));
Actually, you shouldn't even have to modify the library. You can initialize the OkHttpSardine
with your own OkHttpClient
that you can build as you mentioned. We could even add a mention about this in the Readme of the project.
you're right... i removed the explicit setCredentials(log,pass), created a getClient() method and pass the client to the OkHttpSardine constrcutor Works just fine. would be better included by default, but works fine like this Thanks again
Hello i'm getting an authentication failure, HTTP 401 on the list() function.
my code: Sardine sardine = new OkHttpSardine(); sardine.setCredentials("login","password"); List resources = sardine.list("https://mydomain.net/webdav/");
i'm sure the login password are correct, as it works with some other sardine wrapper
anyone would please have an idea ? Thanks brgds alex