1

I have Rails app 1, I want rails app 2 to authenticate through Rails app 1, I wonder if that is possible ?

I'm using devise on both:

The reason behind this is that I have the main network app, which is app 1, and then the nodes of the network which are the other apps, I want all the nodes to be able to authenticate through the main app.

I'm already establishing authentication on each app using 1 main User-table from the main app, but now I just need to figure out how to share the session.


I have looked at the following questions, but they are doing it inside the same database, not across apps:

Rails sessions current practices

Sharing session across rails apps on different subdomains

I want to do exactly what this fellow exactly wants to do:


Rails authentication strategy for noob


Navigate to rails app -->
redirect unauthenticated users to SSO server -->
login and authenticate via remote SSO server -->
callback/redirect to rails app -->
capture user info passed back from SSO server and load protected resources in rails app

UPDATE: I think I can use this Rest-Client to authenticate through rails app 1 on rails app 2. No ? Yea ?

Community
  • 1
  • 1
0bserver07
  • 3,390
  • 1
  • 28
  • 56

1 Answers1

2

Maybe one of this articles will help you:

http://stderr.timfischbach.de/2013/09/14/rails-4-and-sinatra-session-sharing.html

http://robots.thoughtbot.com/how-to-share-a-session-between-sinatra-and-rails

They describe the session sharing between rack based apps (sinatra and rails) but it will also works with two rails apps.

The basic Authentication middleware is the Warden::Manager and you should only have one config.ru for both applications.

Additional hint: Maybe you could use some other session store than a Database, like memcached, redis, couchbase or anything.

sweo
  • 64
  • 3