title: HTTP authentication between devise and iphone app
body: <p>I'm new to ruby on rails but I want to send the data from my SQlite database from my iphone app to the rails web app. Like a "sync" service.</p>
  
  <p>I'm using devise for authentication for the web app. I enabled basic HTTP authentication and I can curl into the website for xml or json data. I can also upload data to the website when I set the post headers to JSON and with username and password.</p>
  
  <p>Here's where I'm stuck. </p>
  
  <p>1) How do I keep the user signed in after the 1st login? Do I use http authentication every time I send data to the website? I've read about token authentication but I'm not sure how to use it.</p>
  
  <p>2) I can post JSON data to something like <a href="http://localhost:3000/example" rel="noreferrer">http://localhost:3000/example</a> with the correct username and password. However, it returns the HTML content if the username and passowrd is incorrect. Do I have to write something that returns json data about login success/fialure?</p>
  
  <p>3) To communicate between my iphone app and my web app. Am I correct in writing a RESTful API on the web app side? Do I need to use active resources?</p>
  
  <p>I'm really stuck on the overall big picture of how all this works. Thanks!</p>