7

I'm building a Multi-Tenant application and I'm struggling incorporating a Facebook Login into the web application.

The tenants are using a sub-domain for example

http://tenant-1.domain.com/
http://tenant-2.domain.com/
http://tenant-3.domain.com/

So, I have created an application and when it comes to add the Website, how can I make it to be available in all tenants? Something like:

enter image description here

But of course, that does not work, and if I add just http://domain.com/ it does not work either on http://tenant-1.domain.com/ as soon I click in the <fb:button-login> I get:

enter image description here

How do I do this, without creating a specific FB App for each tenant?

I'm using this to help persons to subscribe their account, I just want the login to get name and email, or they need to fell that up in the name and email boxes...

balexandre
  • 73,608
  • 45
  • 233
  • 342

1 Answers1

4

This is not possible, but there are options to workaround. I think probably the best would be to use a single domain to perform the authentication, specified as the redirect_uri. On this redirect_uri you can append some query parameters, for example your redirect_uri could be:

http://auth.domain.com/auth.php?tenant=tenant-1

Then in the code for auth.php you would grab this tenant parameter from the query string, authenticate the user, store their access token and then immediately redirect them back to tenant-1.domain.com

I'm not sure if this solution will be something you prefer, but it is currently not possible to specify subdomains for authentication, so this or a similar workaround is necessary.

Matthew Johnston
  • 4,409
  • 2
  • 20
  • 27
  • 1
    not exactly what I would like to have :( will try something else. – balexandre Sep 10 '11 at 06:08
  • Actually, this does seem to work if you include the http:// with the app domain. Check out this answer for more information - http://stackoverflow.com/questions/11932191/facebook-app-on-subdomains-site-url-vs-app-domains It does mean that you will have to have a different subdomain for each app though! – Deano Jan 21 '14 at 12:17