Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to authenticate iOS/iPhone users with remote web application and re-use authentication ticket in future requests to the same web application?
    text
    copied!<p>I am building an iOS application and I need to be able to make authenticated requests to a Rails 3 application for various bits of data. The Rails 3 application is using omniauth and URLs like <a href="https://myapp.com/auth/facebook">https://myapp.com/auth/facebook</a> to, for example, authenticate users via facebook ... and once authenticated, stores the authentication in a secured cookie named "auth.""</p> <p>What I want to know is how to authenticate my users from the iOS/iPhone application, persist the authentication token and send it along with future requests to the Rails application?</p> <hr> <p><strong>Using ASIHTTPRequest I'm thinking of doing something like this:</strong></p> <ol> <li><p>Open a UIWebview, loading with a URL from <em>my</em> web application specific for the provider they want to authenticate with (e.g. myapp.com/auth/facebook for facebook or myapp.com/auth/yahoo for yahoo, etc....).</p></li> <li><p>On success, somehow parse out and store the authentication cookie in the iOS application <em>without</em> displaying the webpage folks usually see when authenticating via the website ... and instead closing the UIWebView and navigating back to another UIVewController in the iOS application.</p></li> <li><p>Somehow include the persisted authentication token with future web requests to the Rails application.</p></li> <li><p>I also want to allow users to allow the iOS application to store this information locally so they don't have to re-login to the remote application if they choose too.</p></li> </ol> <hr> <p>Is this approach appropriate? Is there a better way? And of course, how to actually implement the above?</p> <p>Thanks - wg</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload