When i am trying to login with facebook on my site, after facebook login it throwing
Graph returned 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.
It was working fine two days ago. Today one of my user told me regarding this and when i checked it is throwing error after facebook login.
What is the problem & how do I fix it? I've searched, and found many similar posts, but none of them have a solution that I can figure out how to apply.
Thanx for help in advance
Me too, who can help me?
same issue , i have facing when i am logging with facebook from my app, it throws Graph returned 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
Same here, maybe the last update for strict urls break things ?
guys I also faced this problem just today. In my case it was the sdk version problem (v5.5). I updated to the latest version (v5.6.2) and the problem is fixed. hope this help.
Wonder if this is related to recent data leak scandal and they maybe made some changes to the service.
This is probably related to the strict mode now being compulsory since a few weeks back.
Add your full callback url in the setting at https://developers.facebook.com/apps/XXXXXXXXXXX/fb-login/settings/ (replace XXX with your app id) and that will hopefully fix the problem. :)
It might take a little bit to take full effect. When I changed my URLs I got rid of the error shown to the user but got an error thrown by the SDK when getting access token after the callback. A few hours later it was fine.
Spent many hours fighting this... Simply updating to 5.6.2 solves the problem.
I had issues with this. Noticed that after moving to https:// it still redirects to http://
after long hours of looking into fb sdk found that they have issues detecting if your site is secure.
Developers should take a look.
So, on file
facebookd-v5.*-sdk/Url/FacebookUrlDetectionHandler.php
update two functions.
Updated versions:
protected function protocolWithActiveSsl($protocol)
{
$protocol = strtolower((string)$protocol);
return in_array($protocol, ['on', '1', 'https', 'ssl', 'https, https'], true);
}
and
protected function getHostName()
{
...
// Don't append port number if a normal port.
if (($scheme == 'http' && $port == '80') || ($scheme == 'https' && $port == '443') || ($scheme == 'https' && $port == '80')) {
$appendPort = '';
}
return $host . $appendPort;
}
Hi, tried to update sdk, but problem still remains. Anybody else solved it?
Solved, not only updated sdk, but right callback url - I added there referer parameter, but it was problem for facebook. After removing this parameter, everything works.
karelsmetana - what is considered a right callback url?
for example if my login is https://mydomain/login
and facebook login is https://mydomain/facebook-login
do I need to provide something else there?
lets assume I need only email permission...
@DavidConstantine88 you have to enter callback url, where will be user redirected by facebook.
I'm using PHP 5.5 and I found the bug.
The PHP Facebook API was adding the URI ?code=XXX in my callback page like this:
mydomainExample.com/callbackFacebook.php?code=XXXXXXX and I changed the source code to remove the string after '?'. Now the callback url is only mydomainExample.com/callbackFacebook.php
The fixed is in the file Facebook/Helpers/FacebookRedirectLoginHelper.php inside the getAccessToken function. I added a 'if' as below in line 226 and the issue gone:
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
if(strripos($redirectUrl, "?")){
$redirectUrl = substr($redirectUrl, 0, strripos($redirectUrl, "?"));
}
// At minimum we need to remove the state param
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);
I had the same issue and it was to do with the Valid OAuth Redirect URIs. I had to add "/signin-facebook" for it to work. E.g. https://mydomain/signin-facebook
@ferreirabraga just upgrade to 5.6.2, it includes that fix ;)
@Ivan-ShR thx it was a lifesaver 馃憤
updating to 5.6.2 solved the problem :heart:
updating to 5.6.2 solved the problem here too!
How can we updating to 5.6.2 from 5.4.3 ?
cd into the dir and run composer require package_name:5.6.2
Graph returned 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 sub-domains of your app to the App Domains field in your app settings.
`session_start();
require_once __DIR__ . '/Facebook/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => 'xxxxxxxx',
'app_secret' => 'xxxxxxxxxxxxxxxxxxxx',
'default_graph_version' => 'v2.6',
"persistent_data_handler"=>"session"
]);
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
`
Please help, same issue!
@mithlesh425 have you tried the update to 5.6.2?
Are your settings okay in the APP's settings regarding the domain?
@csimpi thanks, now it's solved by updating to new version.
Solutions:
After along research, the problem got fixed.
Please use the PHP SDK 5.6.2. And edit the following files in the FacebookRedirectLoginHelper.
Edit in PHP SDK
Find file: facebook\graph-sdk\src\Facebook\Helpers\FacebookRedirectLoginHelper.php
Find word
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code']);
Change to
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code','enforce_https']);
iamkarthick's fix works for me
@iamkarthick you saved my life. thank u
@iamkarthick Thanks !! It works!
@iamkarthick many thanks man! It helped a lot 馃憤
@iamkarthick fix works for me
Thanks a whole lot... fix worked!
@iamkarthick worked for me too SDK 5.6.3
fix works for me
Hey,
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 sub-domains of your app to the App Domains field in your app settings.
Please help me.
Most helpful comment
Solutions:
After along research, the problem got fixed.
Please use the PHP SDK 5.6.2. And edit the following files in the FacebookRedirectLoginHelper.
Edit in PHP SDK
Find file: facebook\graph-sdk\src\Facebook\Helpers\FacebookRedirectLoginHelper.php
Find word
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code']);
Change to
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state','code','enforce_https']);