Facebook graph api 使用sdk 5在symfony上登录Facebook
大家好,我需要你们的帮助,我在我的应用程序上安装了带有composer的facebook sdk,我创建了一个登录系统,在facebook developer上,我在localhost上添加了我的开发域,并从生产中添加了我的域,所以在localhost中,登录工作正常,但在生产中我遇到了这个错误Facebook graph api 使用sdk 5在symfony上登录Facebook,facebook-graph-api,symfony1,Facebook Graph Api,Symfony1,大家好,我需要你们的帮助,我在我的应用程序上安装了带有composer的facebook sdk,我创建了一个登录系统,在facebook developer上,我在localhost上添加了我的开发域,并从生产中添加了我的域,所以在localhost中,登录工作正常,但在生产中我遇到了这个错误 Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given, called i
Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given, called in /home/user/src/app/vendor/guzzlehttp/guzzle/src/Client.php on line 89
这是我的部分代码,
在我的安全控制器上
public function facebookCallback(Request $request,UserPasswordEncoderInterface $encoder)
{
$fb = $this->facebook();
$helper = $this->fHelper($fb);
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;
}
if (! isset($accessToken)) {
if ($helper->getError()) {
header('HTTP/1.0 401 Unauthorized');
echo "Error: " . $helper->getError() . "\n";
echo "Error Code: " . $helper->getErrorCode() . "\n";
echo "Error Reason: " . $helper->getErrorReason() . "\n";
echo "Error Description: " . $helper->getErrorDescription() . "\n";
} else {
header('HTTP/1.0 400 Bad Request');
echo 'Bad request';
}
exit;
}
// Logged in
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get('/me?fields=id,name,email,link,picture', $accessToken->getValue());
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$user_info = $response->getGraphUser();
//here i create the user on my app or check if the user exist
}
下面是我对Facebook对象和助手的私有方法
private function facebook()
{
$fb = new Facebook([
'app_id' => 'myapp-id', // Replace {app-id} with your app id
'app_secret' => 'my-secret',
'default_graph_version' => 'v3.1',
]);
return $fb;
}
private function fHelper($fb)
{
$helper = $fb->getRedirectLoginHelper();
return $helper;
}
private function furlLogin()
{
$fb = $this->facebook();
$helper = $this->fHelper($fb);
$permissions = ['email']; // Optional permissions
//$loginUrl = $helper->getLoginUrl('https://devlocalhost.io/es/fb-callback/', $permissions);
$loginUrl = $helper->getLoginUrl('https://my_domain.com/es/fb-callback/', $permissions);
return $loginUrl;
}
因此,在本地主机ys上工作正常,但当我部署操作系统时,我在服务器上安装了依赖项的分支等,给了我这个错误
有什么想法吗?您是否也在您的实时系统上完成了完整的composer安装过程,或者您只是通过FTP将文件从您的本地系统移动到那里?您好,在完整的composer安装过程中,我不使用FTP,在某些情况下只使用git或scp