PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 4, 2022

[FIXED] Graph returned an error: Can't Load URL: The domain of this URL isn't included in the app's domains

 February 04, 2022     facebook, facebook-graph-api, facebook-php-sdk, php     No comments   

Issue

Added domain in App Domains, Valid OAuth redirect URIs also added.. but, Getting error message like this I have done my best... Anybody help me... it was quite irritating, I'm loosing my patience and getting panic. I really don't know, what is my big mistake in this. See this following images to know more about my problem

Image 1

Image 2


Solution

We have 3 ways to fix it

1) Turn Off

Use Strict Mode for Redirect URIs

in Facebook Login-> Settings

2)

$accessToken = $helper->getAccessToken();

to

$accessToken = $helper->getAccessToken('https://example.com/your-CallBack-URI-page.php');

3) This is fine for development purpose when you don't want to waste time, for production use

session_start();
require_once __DIR__ . '/vendor/autoload.php';

$fb = new Facebook\Facebook([
  'app_id' => 'appid',
  'app_secret' => 'app secret',
  'default_graph_version' => 'v2.6 ', 
  "persistent_data_handler"=>"session"
  ]);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email']; // optional

$loginUrl = $helper->getLoginUrl('domain.com/php-graph-sdk-5.x/login-callback.php/', $permissions);
$_SESSION['FBRLH_state']=$_GET['state'];
try {
  $accessToken = $helper->getAccessToken('domian.com/php-graph-sdk-5.x/login-callback.php/');
} 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;
}


Answered By - Omkar Frozen
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing