测试facebook javascript登录从localhost域

Testing facebook javascript Login from localhost domain

本文关键字:localhost 登录 facebook javascript 测试      更新时间:2023-09-26

我刚刚遵循了这里的优秀指南:https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.0关于如何使用Javascript SDK为网站启用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.

我注意到这个错误的URL:

https://www.facebook.com/v2.0/dialog/oauth?scope=public_profile%2Cemail&response_type=none&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fdialog%2Freturn%2Farbiter%3Frelation%3Dopener%26close%3Dtrue%23origin%3Dhttp%253A%252F%252Flocalhost%253A56378%252Ff1c45491ec&seen_revocable_perms_nux=false&ref=LoginButton&auth_type=&default_audience&state=fdcac98d4&app_id=251165285007053&client_id=251165285007053&display=popup

所以我去我的facebook应用程序,添加我的no-ip主机名,'localhost' -它不喜欢localhost,所以我删除了它。

但是我仍然得到消息,因为请求仍然是从域localhost发送的。

是否有一种方法可以让我在本地运行测试?在开发期间,我没有要部署到的域。

在你的应用程序配置中,你应该将你的网站URL设置为http://localhost/

如果你正在使用一个特定的本地主机端口,你必须包括它(例如http://localhost:64321/

)