Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 54
Registered: ‎11-06-2013
My Device: PlayBook, Z30-STA100-5, Z10-STL100-3
My Carrier: AT&T

Pre-setting username/password on WebSites

[ Edited ]

I am looking for a way to pass stored username/password combos into invoked wesites.  I am using a WebVeiw (which works really well) and setting the username and password in the url prior.   This seem to work for some sites, but not all.  Does anyone know of other setting I need to make?  I am not up on the "ways of the Web"

 

QUrl completeURL = QUrl::fromUserInput( webURLString );

 completeURL.setUserName( m_siteDM->siteUsername() );
 completeURL.setPassword( m_siteDM->sitePassword() );

Should I be going to another group to resolve this matter?
----------------------------------------------------------------
iWm
BlackBerry Development Advisor
Posts: 143
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: Pre-setting username/password on WebSites

Those functions are mainly useful for FTP download URLs where you have to login to access that resource.

 

Most Web pages that cause a browser to prompt you for a username and password with a dialog require credentials to be passed via HTTP Basic Authentication.  This requires an extra header in your request (see this link (http://en.wikipedia.org/wiki/HTTP_basic_authentication#Client_side) for more info on how the header looks like.  I don't think you can add anything with QUrl.

 

You would need to set custom headers via WebSettings to add this header to the requests made with the WebView.

Highlighted
Developer
Posts: 237
Registered: ‎05-21-2012
My Device: BlackBerry RED Z10
My Carrier: WiFi

Re: Pre-setting username/password on WebSites

since you're using a WebView you can run a javascript function inside the webview

 

webview.evaluateJavascript("document.getElementById('theUsernameField').value = 'the predefined value'; ");

webview.evaluateJavascript("document.getElementById('thePasswordField').value = 'the predefined value'; ");