AndroidSec
AndroidSec

Reputation: 309

Android WebView - does it support digest authentication?

I think the title is self explanatory. I can't find any resources or references that mention that digest authentication is supported in WebViews.

A couple of caveats:

Upvotes: 2

Views: 2265

Answers (4)

sdaty
sdaty

Reputation: 11

this is working for me:

webView.setHttpAuthUsernamePassword("domain", "realm", "username", "password");
webView.loadUrl("http://domain:port/url/");

Upvotes: 1

insyncim64
insyncim64

Reputation: 125

In one word, it does support HTTP digest authentication. I have tested and sure about it.

Upvotes: 0

Akhil
Akhil

Reputation: 6697

You can set one WebViewClient in your WebView and override below method in your WebViewClient, see below code..

private class ExWebChromeClient extends WebViewClient {
    @Override
    public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
        super.onReceivedHttpAuthRequest(view, handler, host, realm);    //To change body of overridden methods use File | Settings | File Templates.
    }
}

webView.setWebViewClient(new ExWebChromeClient());//set your Extended WebViewClient here

Here you can show one auth dialog..See showHttpAuthentication method from Android native Browser app here, here one http auth dialog is shown and handled properly inside WebView

Upvotes: 1

Nicolas Dusart
Nicolas Dusart

Reputation: 2007

Use the setHttpAuthUsernamePassword method of the WebView to specify the username and password to use. It's used for basic and digest authentication requests.

Upvotes: 0

Related Questions