views:

69

answers:

3

I have a user's name and password stored in their preferences.

How do I go about passing it back into the webview in a secure way? I know if I do this it will work, but it just seems bad. There has to be a better way to post the variables.

webview.loadUrl("http://mysite.com?name="+username+"&password="+somepassword);

I've been looking for days and can't find anything, which make me think I'm missing something obvious.

+1  A: 

You should use HTTPS.

You can also send a salted hash of the password. (Using a server-supplied expiring salt to prevent replay attacks)

SLaks
A: 

what is Salted hash, can you give any example. Thank you in advance, this is very helpful:

Nikhil
A: 

Hi,

Create a WebViewClient which implements onReceivedHttpAuthRequest. Connect this to your webview through method setWebViewClient .

For a working example see http://code.google.com/p/android-sap-note-viewer/source/browse/trunk/SAPNoteView/src/org/sapmentors/sapnoteview/SAPNoteView.java

Dagfinn

dparnas