我想在symfony webapp上测试用facebook登录,我创建了一个测试用户并为该用户请求了访问令牌,我想发送以下帖子请求:
public function setup()
{
$this->access_token = 'CAAL0aG1XXXXXX...';
$this->email = 'test....@tfbnw.net';
$this->uid = '105.......';
$this->formData =json_encode(
array(
'authResponse' => array(
'access_token' => $this->access_token,
'expiresIn' => 5418,
'userID' => $this->uid
),
'status' => 'connected'));
}
public function testFacebookConnection()
{
$client = static::createClient();
// Submit a raw JSON string in the request body
$client->request(
'POST',
$client->getContainer()->get('router')->generate('oauth_connect'),
array(),
array(),
array('CONTENT_TYPE' => 'application/json'),
'{ "service":"facebook","authentication" : "'. $this->formData.'"}'
);
die(var_dump($client->getResponse()->getContent()));
}
Run Code Online (Sandbox Code Playgroud)
在调用URI方法signuature下面
/**
* Calls a URI.
*
* @param string $method The …Run Code Online (Sandbox Code Playgroud)