测试facebook javascript从localhost域登录

时间:2014-07-27 02:19:15

标签: javascript facebook facebook-graph-api facebook-javascript-sdk

我刚刚按照优秀指南: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.

我注意到此错误的网址:

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发送的。

有没有办法测试本地运行?我在开发过程中没有要部署的域。

1 个答案:

答案 0 :(得分:1)

在您的应用配置中,您应将网站网址设置为http://localhost/

如果您正在使用特定的本地端口,则必须包含该端口(例如http://localhost:64321/