rburgst/okhttp-digest

How to use UTF-8 in basic and digest access authentication

SailReal opened this issue · 7 comments

okhttp does support providing different char-sets for authentication. Using the default of okhttp which is ISO_8859_1 I've problems with some servers and chars e.g. "äöü" and want to switch to UTF-8.

How can I archive this using basic and digest access authentication and this library?

String authValue = okhttp3.Credentials.basic(credentials.getUserName(), credentials.getPassword());

If I provide the authentication directly to okhttp using UTF-8 my Nextcloud accepts chars like "äöü" in the password.

.authenticator((route, response) -> {
    String credential = okhttp3.Credentials.basic("test", "äöüäöüäöü", UTF_8);
    return response.request().newBuilder().header("Authorization", credential).build();
})

hm, will check this. Sorry, didnt read the 2nd part of your ticket.

hm, will check this. Sorry, didnt read the 2nd part of your ticket.

Thanks, if you need further information or a test account please let me know.

released 2.4 which adds the ability to provide the charset.

Woooow impressive, thanks for the quick implementation 🚀!

I have already tested it, it works, thanks!

Can you please add it for digest access authentication too?

@rburgst is there a chance that the UTF-8 charset finds a way also in the DigestAuthenticator?