我正在使用 django-allauth用于网站开发中的 Facebook 身份验证并进行相应设置:
在 facebok 的 facebook 应用程序设置中:
Namespace: test_login
App Domains: blank
Site URL: http://127.0.0.1:8000/
Canvas URL: http://127.0.0.1:8000/
Secure Canvas URL: https://127.0.0.1:8000/
在 Django 管理中我创建了新的社交应用:
Provider: Facebook
name: test_login
client_id: xxx
Secret: xxx
Sites: http://127.0.0.1:8000/
如您所见,我添加了一个新站点 http://127.0.0.1:8000/
而不是 example.com
。
settings.py 中的 SITE_ID 是正确的。
所以一切都应该正常工作,但事实并非如此。单击通过 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.
我错过了什么?什么没有配置?据我所知,我应该能够使用 127.0.0.1:8000
进行测试。
最佳答案
将 Facebook 中的 url 设置为 localhost
而不是 127.0.0.1 对我很有用。同时将 localhost:8000
传递给 ./manage.py runserver
关于django allauth facebook本地开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16524499/