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:
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:
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...
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With