图返回错误:无法加载 URL:此 URL 的域未包含在应用程序的域中
在应用程序域中添加了域,还添加了有效的 OAuth 重定向 URI.. 但是,收到这样的错误消息我已经尽力了...任何人都可以帮助我......这很令人恼火,我正在失去耐心并开始恐慌.我真的不知道,我在这方面犯了什么大错.查看以下图片以了解有关我的问题的更多信息
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
推荐答案
我们有 3 种方法来解决它
We have 3 ways to fix it
1) 关闭
对重定向 URI 使用严格模式
Use Strict Mode for Redirect URIs
在 Facebook 登录 -> 设置
in Facebook Login-> Settings
2)
$accessToken = $helper->getAccessToken();
到
$accessToken = $helper->getAccessToken('https://example.com/your-CallBack-URI-page.php');
3) 当您不想浪费时间用于生产用途时,这适用于开发目的
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 FacebookFacebook([
'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(FacebookExceptionsFacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
相关文章