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 .

在这里输入图像描述

链接地址: http://www.djcxy.com/p/22294.html

上一篇: 由于错误的nonce,HTTP摘要认证失败

下一篇: Android Digest身份验证