Access a site that uses basic auth using a WebView
Hi,
Is there any way to point a web view at a site that uses basic auth and handle either setting the credentials in the header or programatically responding to the authentication challenge?
Ideally I'd like the user to enter their credentials in app settings and then handle the auth for the user when I point the Webview at the site on subsequent uses of the app.
With the Native version of this app I created my own NSURLConnection and NSURLRequest objects and handled the didReceiveAuthenticationChallenge() callback, then I took that Request object and handed it to the WebView like this:
[webView loadRequest:_request];
That way the WebView was using the same session where I had already handled the auth under the hood. Make sense?
So, is there any analog for this when using Titanium's WebView? Any creative workaround ideas?
Shaun
Make sense?
2 Answers
-
Accepted Answer
you can use http://username:password@secure.site.com for your http request.
-
jQuery's low level interface for asynchronous requests allows you to pass on a username and password for HTTP authentication:
$.ajax({ // ... username : 'foo', password : 'bar' });
—Any use for you in this case?