Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure a Facebook Application for sub domains

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...

like image 223
balexandre Avatar asked Sep 09 '11 12:09

balexandre


People also ask

How do I add another domain to Facebook app?

Step 1 - Adding your domain to Facebook Business ManagerOpen Facebook Business Manager (sometimes shown as Meta Business Suite). Click on Business Settings. Click on Brand Safety in the left side panel and then choose Domains. Click on Add and enter your domain in the pop-up.

How do you manage sub Domains?

To add or edit a subdomain Choose your app that you want to manage subdomains for. In the navigation pane, choose App Settings, and then choose Domain management. On the Domain management page, choose Manage subdomains. In Edit domain, you can edit your existing subdomains as needed.


1 Answers

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.

like image 101
Matthew Johnston Avatar answered Oct 02 '22 15:10

Matthew Johnston