I have a problem:
- take username and password from user from text filed.
- Automatically sign in to yahoo/google/facebook account and display the webpage in webview.
Basically I dont want user to directly put username and password to yahoo account but go through my application.
Here is my code:
String login = "abcd";
String pwd = "1234";
String streamSend = "";
Object pwfields;
//initial post to login handler
URL url1;
PrintStream outStream;
HttpURLConnection conn;
try {
url1 = new URL("https://login.yahoo.com/config/login?");
conn = (HttpURLConnection)url1.openConnection();
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
//generate request stream
outStream = new PrintStream(conn.getOutputStream());
//add the fields and values for each part of the multipart POST
streamSend += "Content-Disposition: form-data; login=\""+login+"\"\r\n";
streamSend += "\r\n";
streamSend += pwd+"\r\n";
//send POST to server and close stream
outStream.print(streamSend);
webView.loadUrl("https://login.yahoo.com/config/login?");
webView.requestFocus();
This code have problems, it doesn't work..and also do I have to encrypt password. Any sample code or reference wud be very helpful.