在最后一次调用以检索令牌时,我正在执行以下操作:
$HttpSocket = new HttpSocket();
$q = array(
'grant_type'=>'authorization_code',
'client_id'=>Configure::read('Mailchimp.ClientId'),
'client_secret'=>Configure::read('Mailchimp.ClientSecret'),
'redirect_uri'=>urlencode(Router::url('/connected_apps/mailchimp', true)),
'code'=>$_GET['code']
);
$res = $HttpSocket->post('http://login.mailchimp.com/oauth2/token', $q);
echo($res->body());
exit;
响应正文如下所示:
‹ÿÿ
这是调试请求的结果。
'method' => 'POST',
'uri' => array(
'host' => '*****',
'port' => '*****',
'scheme' => 'http',
'user' => null,
'pass' => null,
'path' => '/oauth2/token',
'query' => array(),
'fragment' => null
),
'version' => '1.1',
'body' => 'grant_type=authorization_code&client_id=********&client_secret=********&redirect_uri=http%253A%252F%252Fdomain.com%252Fconnected_apps%252Fmailchimp&code=*********',
'line' => 'POST /oauth2/token HTTP/1.1
',
'header' => 'Host: login.mailchimp.com
Connection: close
User-Agent: CakePHP
Content-Type: application/x-www-form-urlencoded
Content-Length: 219
',
'raw' => 'POST /oauth2/token HTTP/1.1
Host: login.mailchimp.com
Connection: close
User-Agent: CakePHP
Content-Type: application/x-www-form-urlencoded
Content-Length: 219
grant_type=authorization_code&client_id=********&client_secret=********&redirect_uri=http%253A%252F%252Fdomain.com%252Fconnected_apps%252Fmailchimp&code=*********
',
'redirect' => false,
'cookies' => array(),
'proxy' => array(),
'auth' => array()