How to set up a Facebook application for subdomains

I am creating a Multi-Tenant application and I am struggling , which includes entering the Facebook web application.

Tenants use a subdomain, for example

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

So, I created the application, and when it comes to adding a Website, how can I make it accessible to all tenants? Something like:

enter image description here

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

enter image description here

How to do this without creating a specific FB application for each tenant?

I use this to help people sign up for their account, I just want the login to get a name and email address , or they should drop in names and mailboxes ...

+7
source share
1 answer

This is not possible, but there are options to work around. I think it would be best to use a single domain for authentication, specified as redirect_uri. On this redirect_uri you can add some query parameters, for example, your redirect_uri can 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, save his access token, and immediately redirect it back to tenant-1.domain.com

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

+4
source

All Articles