6

I have search everywhere but I can't seem to find the right answer for my problem. So here goes.

I have 2 domains....

http://www.mywebsite.com/ and http://app.mywebsite.com/

Those two domains are in two different rails apps.

Devise resides in app.mywebsite.com. I have a login/signup form in www.mywebsite.com that will connect to app.website.com. How do I do this?

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
Eralph
  • 944
  • 1
  • 9
  • 23

1 Answers1

8

You need to share the model devise session

Try this

Just modify the config/initializers/session_store.rb

Yourapp::Application.config.session_store :cookie_store, key: '_Yourapp_session', :domain => '.mywebsite.com'

It works on my applications.

UPDATE

For my answer above, I only tried in one application but different schema, and it works.

Devise model not works if you not put gem devise. :D

If different application, you need www.mywebsite.com access to database of mywebsite.com Or you can use SSO for your applications.

I think you need this :

  1. Multiple Applications with Devise, Omniauth and Single Sign On
  2. sso-devise-omniauth-provider

Some similar questions :

  1. Single logon with different applications approach ruby on rails
  2. How to pass devise sign_in information into different application with rails
  3. OmniAuth Single Sign On with Devise
Community
  • 1
  • 1
rails_id
  • 8,120
  • 4
  • 46
  • 84