Android Digest Authentication
I'm trying to get Digest Authentication to work on Android. I'm using https://hc.apache.org/ which supports Basic and Digest I believe.
DefaultHttpClient dhc = (DefaultHttpClient) httpClient;
AuthScope authScope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM);
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(authScope, credentials);
dhc.setCredentialsProvider(credentialsProvider);
The server returns a 401
with the Www-Authenticate
header indicating to use Digest Auth (providing the nonce, qop).
Then the second request is sent with the Authorization
header containing the Digest. This request also returns a 401
.
下一篇: Android Digest身份验证