You probably want to assign some kind of Token/API Key to each user. You 
can use that in your requests (be it in the request params or in the 
header) and then authenticate in your controllers. I would look into the 
"authenticate_or_request_with_http_token" method which checks your request 
headers for the Token. Then in your iOS application, you can 'login' a user 
by saving their API key (I'm unfamiliar with iOS...I know Android has 
SharedPreferences and Database possibilities for storing data) and then 
each time you need to use communicate with the Rails web service, pass that 
Token in the headers or however you do it. I believe you do not need to 
simulate/worry about 'sessions'.

On Monday, February 25, 2013 10:05:33 PM UTC-6, CiriusMex wrote:
>
> Oh, I'm working with rails 2.3.5 btw...
>
> El lunes, 25 de febrero de 2013 22:04:47 UTC-6, CiriusMex escribió:
>>
>> Hello, I'm creating a serie of "WebServices" from a rails application so 
>> that an iOS App will be able to communication with the WebApp. Basically 
>> I'm creating functions that get a json request, analyse it and send a json 
>> result...I've never done that before and I have a huge problem: I have no 
>> idea how to manage session for WebServices. The idea is that a user log 
>> from the iOS App to the WebApp using a webservice. I was able to create a 
>> function that does the login but how do I do to remember the user next time 
>> the App calls a webservice? In my WebApp it's pretty easy, I check the 
>> session for user information but in that case I have no clue about what to 
>> do...I thought of saving the session in a DB table but doesn't seems like 
>> the best solution, is there any way a session can be loaded from a token or 
>> something?
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/rlv2EYcYjakJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to