如何使 facebook 应用程序允许来自在本地服务器上运行的 django 项目的请求?
How to make facebook app allow requests from django project that runs on a local server?
我正在尝试使用 django social auth 通过 facebook 进行身份验证。
我使用 this 文档在我的 django 项目中进行更改并创建和设置 facebook 应用程序。我是本地服务器上的 运行 django 项目。该项目有 url http://127.0.0.1:8000
。当在我的项目网页上点击以下 link 时:
模板
<p><a href="{% url "socialauth_begin" "facebook" %}">Facebook</a></p>
渲染模板
<p><a href="/accounts_social/login/facebook/">Facebook</a></p>
它将我重定向到一个 Facebook 页面,我可以在其中看到以下消息:
Given URL is not allowed by the Application configuration: One or more
of the given URLs is not allowed by the App's settings. It must match
the Website URL or Canvas URL, or the domain must be a subdomain of
one of the App's domains.
如何更改 Facebook 应用程序的设置以允许
http://127.0.0.1:8000
?
upd
在我的 Facebook 应用程序设置中将 localhost
添加到应用程序域并将 http://localhost:8000/
添加到站点 URL。
Facebook 应用程序不允许这样的 IP 地址,但它允许 localhost
。在“设置”选项卡上的“应用程序域”中,您需要添加 localhost
。糟糕的是其他服务(比如twitter)不接受localhost,你只能使用127.0.0.1:8000,这意味着你必须来回切换。
它适用于本地开发,但它并不漂亮。
编辑:
您还需要先将 http://localhost:8000/
添加到站点 URL
我正在尝试使用 django social auth 通过 facebook 进行身份验证。
我使用 this 文档在我的 django 项目中进行更改并创建和设置 facebook 应用程序。我是本地服务器上的 运行 django 项目。该项目有 url http://127.0.0.1:8000
。当在我的项目网页上点击以下 link 时:
模板
<p><a href="{% url "socialauth_begin" "facebook" %}">Facebook</a></p>
渲染模板
<p><a href="/accounts_social/login/facebook/">Facebook</a></p>
它将我重定向到一个 Facebook 页面,我可以在其中看到以下消息:
Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
如何更改 Facebook 应用程序的设置以允许
http://127.0.0.1:8000
?
upd
在我的 Facebook 应用程序设置中将 localhost
添加到应用程序域并将 http://localhost:8000/
添加到站点 URL。
Facebook 应用程序不允许这样的 IP 地址,但它允许 localhost
。在“设置”选项卡上的“应用程序域”中,您需要添加 localhost
。糟糕的是其他服务(比如twitter)不接受localhost,你只能使用127.0.0.1:8000,这意味着你必须来回切换。
它适用于本地开发,但它并不漂亮。
编辑:
您还需要先将 http://localhost:8000/
添加到站点 URL