views:

499

answers:

1

I have a server side app written in Rails using the authlogic plugin. I am not sure how to login to the rails app from my iphone client. I think I know how to write get/post code in Obj C, but I'm not sure what the best approach is of authenticating with my rails server. Here is what the server side HTML looks like when you go to this URL:http://localhost%3A3000/user%5Fsessions/new : http://pastie.org/596279

A: 

To authenticate from your iPhone app you will need to:

  1. Disable cross site request forgery for the form actions

  2. HTTP POST user_session[username] and user_session[password] to your FQDN + '/user_sessions'

  3. Capture the session cookies returned from the site (and return these with subsequent requests) to take further actions in the application.

Depending on what your overall goal is, it might be better to write a custom authentication piece that would use the iPhone's internal ID and a combination of the username and password to create unique token to use for the session on the site.

Mike Buckbee