How to authenticate one Ruby on Rails app to another, using RESTful_authentication gem?
-
11-09-2019 - |
Question
Anybody have any ideas? The situation is like this: I have a primary rails app and an auxiliary one. The auxiliary app is used to transform a web service request into a RESTful PUT to the main app. The resource the auxiliary app is attempting to add to requires authentication. Any ideas would be much appreciated! Thanks SO!
Solution
ActiveResource is used for this purpose:
class MyModel < ActiveResource::Base
self.site = OTHER_APP_URL
self.user = OTHER_APP_USER
self.password = OTHER_APP_PASSWORD
# Rest of the code here
end
Read up on how to talk to RESTful API from ActiveResource here: http://api.rubyonrails.org/classes/ActiveResource/Base.html
OTHER TIPS
I think I may have found my own answer by polling some of my IM contacts. The most logical approach is to use the Curb ruby gem. From the aforementioned API, one simply enables the cookie jar, restfully authenticates and then includes the cookie in subsequent HTTP actions requiring authentication ;)
(Will post some code when I get this implemented..)
Would still appreciate comments and or alternatives though!