Avi wrote in post #1075999:
> So, here is what I am trying to do :-
>
> login_response = RestClient.post 'Some URL', :userName => 'username',
> :password => 'password' // Here I am logging in to the site.
> puts "login_response" // Here I am getting the response as an xml
> format
> which is a session_id
>
> So for accessing the content after login, I need session id to perform
> CRUD
> operations.
>
> search = RestClient.get 'URL after login to search a list' // here
> need
> to pass the session id. Or any suggestions what need to do in this case
> ?
I've handled clients like these in one of a few of ways:
1. Use a client implementation that supports HTTP cookies just like a
web browser does. Login the normal way and let the client manage passing
the cookie back to the server (just like a browser).
2. Use a token based client authentication mechanism where the token is
generated by the server with that token bound to the user account.
Something like what Pivotal Tracker does with their API tokens.
3. Use something like OAuth, which provides a way for external clients
to authenticate through the OAuth protocol (probably overkill for your
needs).
--
Posted via
http://www.ruby-forum.com/.