问题描述
我正在建立一个多租户应用程序,而且我正在努力将Facebook登录整合到网络应用程序中。
租户正在使用子域例如
http://tenant-1.domain.com/
http: //tenant-2.domain.com/
http://tenant-3.domain.com/
所以,我创建了一个应用程序,当它添加网站,如何使它在所有租户可用?类似:
p>
当然,这不行,如果我只添加 http://domain.com/
在< fb:button-login> 上点击后,在
http://tenant-1.domain.com/
/ code>我获得:
我使用这个来帮助人订阅他们的帐户,我只是希望登录获得姓名和电子邮件,或者他们需要在名称和电子邮件框中...
这是不可能的,有解决方法的选项。我认为最好是使用单个域来执行身份验证,指定为redirect_uri。在此redirect_uri上,您可以附加一些查询参数,例如您的redirect_uri可以是:
http://auth.domain.com/auth。然后在auth.php的代码中,您将从查询字符串中获取此租户参数,验证该查询字符串中的租户参数。存储他们的访问令牌,然后立即将他们重定向到
tenant-1.domain.com
m不确定这个解决方案是否是您喜欢的,但目前无法指定用于身份验证的子域,因此需要此类似的解决方法。
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:
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...
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.
这篇关于如何配置子域的Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!