无法加载 URL:此 URL 的域未包含在应用的域中 - Facebook 登录

Can't Load URL: The domain of this URL isn't included in the app's domains - Facebook Login

我正在尝试从用户那里获取访​​问令牌

string response_script = "<script>top.location.href='https://www.facebook.com/v2.4/dialog/oauth?response_type=token&client_id=[APPLICATION ID]&redirect_uri=https://www.facebook.com/[APPLICATION URL]/?sk=app_[PAGE ID]&scope='; </script>";

但是我收到一个错误:

Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

该代码运行良好。所以我认为需要将我的 url 添加到

Valid OAuth redirect URIs

但是高级部分已经不存在了。 facebook 更改了它的设计,现在看起来像 this. It's too big image and because I have it in out of Whosebug

我能做什么?

我遇到了和你一样的问题,我解决了。 Facebook 现在将一些功能定位为插件。在左侧 select 产品并添加产品。然后 select Facbook 登录。从那里非常直接,您会看到所有 Oauth 选项都出现了。

如其他答案所说,在左侧 select 产品并添加产品。然后 select Facbook 登录。

然后我将 http://localhost:3000/ 添加到字段 'Valid OAuth redirect URIs',然后一切正常。

有效的 OAuth 重定向 URIs 上添加我的本地主机 https://developers.facebook.com/apps/YOUR_APP_ID/fb-login/ 解决了问题!

还有一个细节要注意:

在这种情况下 http://localhost:3000 is not the same of http://0.0.0.0:3000 or http://127.0.0.1:3000

确保您使用的是沙盒服务器的 运行 url。 我花了一些时间发现...

我有同样的问题,它来自错误的 client_id / Facebook App ID。

您是否将 Facebook 应用程序切换到 "public" 或“在线”?当您这样做时,Facebook 会创建一个具有新应用程序 ID 的新应用程序。

您可以将 url 中的 "client_id" 参数值与您的 Facebook 控制面板中的参数值进行比较。

另外请确保您的应用是 public。单击 + 添加产品 现在转到产品 => Facebook 登录 现在执行以下操作:

有效的 OAuth 重定向 URI:example.com/

如果您使用的是 AWS,请转到 Facebook 开发人员控制台 - https://developers.facebook.com/

您需要从用户池 > 应用程序集成 > Amazon Cognito 域中添加 URL,并向其添加 /oauth2/idpresponse,例如:

https://myappxxxxx-xxxx-dev.auth.us-east-2.amazoncognito.com/oauth2/idpresponse