FB.ui 共享对话框:“此 URL 的域未包含在应用程序的域中”
FB.ui share dialog: “The domain of this URL isn't included in the app's domain”
我尝试使用 Facebook javascript SDK 实现共享对话框。当我打开对话框时,我收到一条错误消息,指出此 URL 的域未包含在应用程序的域中。
我试图在我的 Facebook 开发者控制台中添加所有域和所有子域,在 "Facebook login - valid OAuth" 但也许因为我尝试使用共享对话框,这些域应该添加到其他地方?
注意:我的应用程序实现了 Facebook 登录,我可以确认我没有遇到此流程的任何问题,登录的域是正确的并且登录工作正常。
我的代码:
FB.ui({
app_id: 'XXXXXXXXXXX',
method: 'share',
href: 'https://something.com'
}, (response: any) => {
console.log(response);
});
更新
我遇到的错误信息是英文的
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.
有趣的是,在我的 Facebook 开发者控制台中,我有 6 个不同的 URL 允许作为 OAuth 重定向。我试图将它们全部指定为 redirect_uri
参数,并且共享对其中两个有效,但对其他四个无效 ?!!??!
允许 OAuth URL(按此顺序)> 分享结果
https://mymaindomain.com/ > Share ok
https://mymaindomain.com/something/ > Share ok
https://mystaging.com/ > Share KO
https://mystaging.com/something/ > Share KO
https://m.mystaging.com/ > Share KO
https://m.mymaindomain.com/ > Share KO
我选择了 'send' 选项而不是 'share' 似乎更可靠
FB.ui({
method: 'send',
link: 'https://something.com',
app_id: XXXXXXXXXXX'
}, (response: any) => {
console.log(response);
});
我遇到了同样的问题,但我已经解决了。
我的解决方案:
- 打开脸书APP。
- 设置 -> 基本
- 设置应用域 [something.com]
- 设置网站 -> 站点 Url -> [https://something.com]
我尝试使用 Facebook javascript SDK 实现共享对话框。当我打开对话框时,我收到一条错误消息,指出此 URL 的域未包含在应用程序的域中。
我试图在我的 Facebook 开发者控制台中添加所有域和所有子域,在 "Facebook login - valid OAuth" 但也许因为我尝试使用共享对话框,这些域应该添加到其他地方?
注意:我的应用程序实现了 Facebook 登录,我可以确认我没有遇到此流程的任何问题,登录的域是正确的并且登录工作正常。
我的代码:
FB.ui({
app_id: 'XXXXXXXXXXX',
method: 'share',
href: 'https://something.com'
}, (response: any) => {
console.log(response);
});
更新
我遇到的错误信息是英文的
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.
有趣的是,在我的 Facebook 开发者控制台中,我有 6 个不同的 URL 允许作为 OAuth 重定向。我试图将它们全部指定为 redirect_uri
参数,并且共享对其中两个有效,但对其他四个无效 ?!!??!
允许 OAuth URL(按此顺序)> 分享结果
https://mymaindomain.com/ > Share ok
https://mymaindomain.com/something/ > Share ok
https://mystaging.com/ > Share KO
https://mystaging.com/something/ > Share KO
https://m.mystaging.com/ > Share KO
https://m.mymaindomain.com/ > Share KO
我选择了 'send' 选项而不是 'share' 似乎更可靠
FB.ui({
method: 'send',
link: 'https://something.com',
app_id: XXXXXXXXXXX'
}, (response: any) => {
console.log(response);
});
我遇到了同样的问题,但我已经解决了。
我的解决方案:
- 打开脸书APP。
- 设置 -> 基本
- 设置应用域 [something.com]
- 设置网站 -> 站点 Url -> [https://something.com]