如何为子域配置 Facebook 应用程序

发布于 2024-12-04 01:54:59 字数 723 浏览 1 评论 0 原文

我正在构建一个多租户应用程序,并且正在努力将 Facebook 登录合并到 Web 应用程序中。

例如,租户正在使用子域

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

因此,我创建了一个应用程序,当需要添加网站时,如何才能使其在所有租户中可用?类似于:

在此处输入图像描述

但是当然,这不起作用,如果我只添加 http: //domain.com/ 当我点击 http://tenant-1.domain.com/ 上也不起作用登录> 我得到:

在此处输入图像描述

如何执行此操作,而不为每个租户创建特定的 FB 应用程序?

我用它来帮助人们订阅他们的帐户,我只想登录以获取姓名和电子邮件,或者他们需要将其放在姓名和电子邮件框中......

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

混浊又暗下来 2024-12-11 01:54:59

这是不可能的,但有一些解决方法。我认为最好的方法可能是使用单个域来执行身份验证,指定为redirect_uri。在此redirect_uri上,您可以附加一些查询参数,例如您的redirect_uri可以是:

http://auth.domain.com/auth.php?tenant=tenant-1

然后在auth的代码中。在 main.php 中,您可以从查询字符串中获取此租户参数,对用户进行身份验证,存储其访问令牌,然后立即将其重定向回 tenant-1.domain.com

我不确定此解决方案是否有效是您喜欢的东西,但目前不是可以指定子域进行身份验证,因此此或类似的解决方法是必要的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文