我正在尝试使用Instagram API,但我的请求在第3步失败:Request the access_token。
请注意,响应内容中没有消息。错误很简单,Bad Request
。
为什么我的请求不会通过?
注意:我的请求是使用Net::OAuth2 perl库创建和发送的。
'_protocol' => 'HTTP/1.1',
'_content' => 'grant_type=authorization_code&redirect_uri=http%3A%2F%2Fredirecturi.net%3A4011%2Ffoo%2Fbar%2Ffoobar_callback&client_id=XXX&client_secret=YYY&code=ab1ef9ea901f401eb2ae798617e3b098',
'_uri' => bless( do{\(my $o = 'https://api.instagram.com/oauth/access_token')}, 'URI::https' ),
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.05',
'connection' => 'Keep-Alive',
'content-type' => 'application/x-www-form-urlencoded',
'::std_case' => {
'if-ssl-cert-subject' => 'If-SSL-Cert-Subject'
},
'authorization' => 'Basic XXX',
'host' => 'api.instagram.com:443'
}, 'HTTP::Headers' ),
'_method' => 'POST',
'_uri_canonical' => $VAR1->{'_request'}{'_uri'}
}, 'HTTP::Request' )
'_protocol' => 'HTTP/1.1',
'_content' => '',
'_rc' => '400',
'_headers' => bless( {
'connection' => 'close',
'client-response-num' => 1,
'date' => 'Thu, 07 Jan 2016 19:17:52 GMT',
'client-ssl-cert-issuer' => '/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA',
'client-ssl-cipher' => 'ECDHE-RSA-AES128-SHA',
'client-peer' => '66.220.158.81:443',
'content-length' => '0',
'::std_case' => {
'client-date' => 'Client-Date',
'client-response-num' => 'Client-Response-Num',
'client-ssl-cert-subject' => 'Client-SSL-Cert-Subject',
'client-ssl-cert-issuer' => 'Client-SSL-Cert-Issuer',
'client-ssl-cipher' => 'Client-SSL-Cipher',
'client-peer' => 'Client-Peer',
'client-ssl-socket-class' => 'Client-SSL-Socket-Class'
},
'client-date' => 'Thu, 07 Jan 2016 19:17:52 GMT',
'content-type' => 'text/plain',
'client-ssl-cert-subject' => '/C=US/ST=CA/L=Menlo Park/O=Instagram LLC/CN=*.instagram.com',
'server' => 'proxygen',
'client-ssl-socket-class' => 'IO::Socket::SSL'
}, 'HTTP::Headers' ),
'_msg' => 'Bad Request',
}, 'HTTP::Response' );