3

I'm have omniauth working in my Rails app on the top level domain.

Now I want to do it on any given subdomain (users each get their own subdomain assigned dynamically).

  • I can't find a way to dynamically change the callback url on the fly with omniauth

  • Leaving it as is, in the callback I can see the referrer and know which subdomain they came from, and log them in, but when I then redirect them to their subdomain they are logged out because the session was on the top level domain.

I'm using the omniauth-facebook gem if that matters: https://github.com/mkdynamic/omniauth-facebook

What's the best way to handle this?

99miles
  • 10,942
  • 18
  • 78
  • 123

1 Answers1

0

I don't think that Omniauth let's you change this dynamically, but you can share the session between all subdomains, and continue to use the redirection approach. Just change your session_store to include domain (and tld_length if you need it - more details here)

Rails.application.config.session_store ... , domain: :all
Community
  • 1
  • 1
gwcodes
  • 5,632
  • 1
  • 11
  • 20