Android OkHttp with Basic Authentication-open source projects square/okhttp
Jesse Wilson
Try using OkAuthenticator:
client.setAuthenticator(new OkAuthenticator() {
@Override public Credential authenticate(
Proxy proxy, URL url, List challenges) throws IOException {
return Credential.basic("scott", "tiger");
}
@Override public Credential authenticateProxy(
Proxy proxy, URL url, List challenges) throws IOException {
return null;
}
});