[英]Sorry, something went wrong using PHP Facebook SDK trying login to get via facebook working
I get the error every time I try to I use the loginUrl.每次尝试使用 loginUrl 时都会收到错误消息。 I've done all the necessary things in facebook dev portal
我已经在 facebook 开发门户中完成了所有必要的事情
<?php
session_start();
require( __DIR__.'/src/Facebook/autoload.php');
$fb = new Facebook\Facebook([
'app_id' => '{}', // Replace {app-id} with your app id
'app_secret' => '{}',
'default_graph_version' => 'v2.5',
]);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email', 'user_posts']; // optional
$loginUrl = $helper->getLoginUrl($callback, $permissions);
echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
?>
Your app_id
and app_secret
shouldn't have {}
around them.您的
app_id
和app_secret
不应有{}
。 And it might not be the best idea to post your app_secret
here.在这里发布您的
app_secret
可能不是最好的主意。
So your code would be this:所以你的代码是这样的:
<?php
session_start();
require( __DIR__.'/src/Facebook/autoload.php');
$fb = new Facebook\Facebook([
'app_id' => '119245818585909', // Replace {app-id} with your app id
'app_secret' => '6a4bb23f0b6bc1c6b3f0cd6bf5e3239f',
'default_graph_version' => 'v2.5',
]);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email', 'user_posts']; // optional
$loginUrl = $helper->getLoginUrl($callback, $permissions);
echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.