I've created an application which loads a WebView. In order to login, the website requires basic authentication. When i try to access the website via the default browser, I get a pop up box prompting me to enter my user name and password.
If I try to access the website via my application, I get error 401 and no pop up. I was wondering if someone could help me out?
HTTP basic authentication is a simple challenge and response mechanism with which a server can request authentication information (a user ID and password) from a client. The client passes the authentication information to the server in an Authorization header.
Saving passwords in WebView will not be supported in future versions. Retrieves HTTP authentication credentials for a given host and realm from the WebViewDatabase instance.
By default this is set to true and the WebView accepts cookies.
I reckon a more elegant solution than the one Patrick describes would be to use the onReceivedHttpAuthRequest
method of WebViewClient as described here: http://www.mail-archive.com/[email protected]/msg30468.html
@Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { handler.proceed("username", "password"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With