rburgst/okhttp-digest

Can't use OkHttpClient.Builder().addInterceptor() or OkHttpClient.Builder().authenticator()

Closed this issue · 2 comments

Hello!,
The examples for this library seem outdated, but I have been trying to use it on the last okhttp release (3.0.0-RC1) as such:

DigestAuthenticator authenticator = new DigestAuthenticator(new Credentials("user", "password"));
final Map<String, CachingAuthenticator> authCache = new ConcurrentHashMap<>();

client = new OkHttpClient.Builder()
.addInterceptor(new AuthenticationCacheInterceptor(authCache))
.authenticator(new CachingAuthenticatorDecorator(authenticator, authCache))
.build();

The problem is that neither .addInterceptor() or .authenticator() accepts AuthenticationCacheInterceptor or CachingAuthenticatorDecorator as values.

How is it supposed to be used now?

Thanks and best regards!

Haven't looked much on okhttp 3.0 yet. I got a pull request from Jesse but didn't realise that it would affect the basic usage. Will update docs in the next few days.

I can confirm that it's working for me on a quick test. Thank you!