How to transfer website login data from UIWebView directly, without having to log in again?

I want to open some website in my iphone application using UIWebView. The website requires a username and password, and I have this username and password.

I was wondering, is there anyway I can open a website in my UIWebView without a login screen? I mean, since I already have a username and password, can I use this information to automatically log in to the site and display the necessary page in the UIWebView iphone application.

I just want to get rid of registration on the website, as users have already entered login information when opening the application. This is redundant.

Any help is greatly appreciated.

Thanks.

+6
iphone login uiwebview autologin
source share
2 answers

I found a way to solve this problem using Objective-C. We can use NSURLConnection to submit the form.

the code:

NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://mobile.twitter.com/session"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; [theRequest setHTTPMethod:@"POST"]; NSString *postString = [NSString stringWithFormat:@"authenticity_token=%@&username=%@&password=%@",@"9b670208fd22850ec791",@"urUsername",@"urPWD"]; [theRequest setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; // create the connection with the request // and start loading the data NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection) { // Create the NSMutableData to hold the received data. // receivedData is an instance variable declared elsewhere. receivedData = [[NSMutableData data] retain]; } else { // Inform the user that the connection failed. } 

Ask me if you need more information.

+2
source share

If you yourself have created a website, why not create another entry point where you safely pass the username / password using ssl to the page? If SSL is not a parameter, you can create a token in the application and pass this. It does not require a username and password.

0
source share

All Articles