How to configure a Facebook Application for sub domains

百般思念 提交于 2020-01-02 02:53:49

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/7361941/how-to-configure-a-facebook-application-for-sub-domains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!