I have tried setting a custom OkHttpClient with a custom Authenticator, however as the doc says: \"Responds to authentication challenges from the remote web or proxy server.
You can also add Authentication as suggested in the documentation of OkHttp
Just add this client
final OkHttpClient client = new OkHttpClient.Builder()
.authenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = okhttp3.Credentials.basic("user", "pw");
return response.request().newBuilder()
.header("Authorization", credential)
.build();
}
})
.build();
to Picasso like this:
final Picasso picasso = new Picasso.Builder(this)
.downloader(new OkHttp3Downloader(client))
.build();
Picasso.setSingletonInstance(picasso);
The only dependency needed is:
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'