Javascript 无法加载 URL:此 URL 的域未包含在应用程序的域中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37255315/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 20:05:49  来源:igfitidea点击:

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

javascriptfacebookfacebook-access-tokentabpage

提问by gsiradze

I'm trying to get access token from user

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

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>";

But I'm getting an error:

但我收到一个错误:

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:此 URL 的域未包含在应用程序的域中。为了能够加载此 URL,请将您应用的所有域和子域添加到应用设置中的“应用域”字段。

That code works well. So I think that needs to add my url to

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

Valid OAuth redirect URIs

有效的 OAuth 重定向 URI

ButIt doesn't exists in advanced section anymore. facebook changed it's design and now it looks like this. It's too big image and because I have it in out of stackoverflow

它不再存在于高级部分。facebook 改变了它的设计,现在它看起来像这样。图片太大了,因为我把它放在了 stackoverflow 之外

What can I do?

我能做什么?

回答by Neo

I had the same issue as you, I figured it out. Facebook now roles some features as plugins. In the left hand side select Products and add product. Then select Facbook Login. Pretty straight forward from there, you'll see all the Oauth options show up.

我遇到了和你一样的问题,我已经解决了。Facebook 现在将某些功能用作插件。在左侧选择产品并添加产品。然后选择 Facebook 登录。从那里直接开始,您会看到所有 Oauth 选项都显示出来。

回答by leevigilstroy

Like the other answer says, in the left hand side select Products and add product. Then select Facbook Login.

就像另一个答案所说,在左侧选择产品并添加产品。然后选择 Facebook 登录。

I then added http://localhost:3000/to the field 'Valid OAuth redirect URIs', and then everything worked.

然后我将http://localhost:3000/ 添加到“有效的 OAuth 重定向 URI”字段中,然后一切正常。

回答by mourodrigo

Adding my localhost on Valid OAuth redirect URIsat https://developers.facebook.com/apps/YOUR_APP_ID/fb-login/solved the problem!

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

And pay attention for one detail here:

并注意这里的一个细节:

In this case http://localhost:3000is not the same ofhttp://0.0.0.0:3000or http://127.0.0.1:3000

在这种情况下http://localhost:3000http://0.0.0.0:3000http://127.0.0.1:3000 不同

Make sure you are using exactly the running url of you sandbox server. I spend some time to discover that...

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

enter image description here

在此处输入图片说明

回答by Vincent J. Michuki

I had the same problem, and it came from a wrong client_id / Facebook App ID.

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

Did you switch your Facebook app to "public" or "online ? When you do so, Facebook creates a new app with a new App ID.

您是否将 Facebook 应用切换为“公开”或“在线”?当您这样做时,Facebook 会创建一个具有新 App ID 的新应用。

You can compare the "client_id" parameter value in the url with the one in your Facebook dashboard.

您可以将 url 中的“client_id”参数值与 Facebook 仪表板中的值进行比较。

Also Make sure your app is public. Click on + Add product Now go to products => Facebook Login Now do the following:

还要确保您的应用程序是公开的。单击 + 添加产品 现在转到产品 => Facebook 登录 现在执行以下操作:

Valid OAuth redirect URIs : example.com/

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