Reputation: 8672
I try to implement the share dialog with the Facebook javascript sdk. When I open the dialog I get an error that the domain of this URL isn't included in the app's domain.
I tried to add all domains and all sub-domains in my Facebook developers console, in the "Facebook login - valid OAuth" but maybe since I try to use the share dialog these domains should be added elsewhere?
Note: My app implement a Facebook login and I could confirm that I don't face any problems with this flow, the domains are correct for the login and the login works fine.
My code:
FB.ui({
app_id: 'XXXXXXXXXXX',
method: 'share',
href: 'https://something.com'
}, (response: any) => {
console.log(response);
});
UPDATE
In english, the error msg I face
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.
Funny things, in my Facebook developer console I've got 6 different URLs allowed as OAuth redirect. I tried to specify all of them as redirect_uri
parameter and the share worked for two of them but failed for the other four ?!!??!
OAuth allowed URL (in this order) > Result of share
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
Upvotes: 2
Views: 1273
Reputation: 8672
I went with the 'send' option instead of 'share' wich seems to be more reliable
FB.ui({
method: 'send',
link: 'https://something.com',
app_id: XXXXXXXXXXX'
}, (response: any) => {
console.log(response);
});
Upvotes: 0
Reputation: 41
I had the same issue, but I fix it.
My solution:
Upvotes: 3