I'm using PECL OAuth when trying to authenticate to an API.
Sample Code:
<?php
$requestUri = 'http://openapi.lovefilm.com/oauth/request';
$consumerKey = 'MYCONSUMERKEY';
$consumerSecret = 'MYSECRET';
$oauth = new OAuth($consumerKey, $consumerSecret);
$oauth->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setVersion('1.0');
$oauth->setTimestamp(mktime());
$oauth->enableDebug();
try
{
$req = $oauth->getRequestToken($requestUri, 'oob');
var_dump($req);
}
catch(OAuthException $e)
{
print '<pre>';
var_dump($e);
var_dump($oauth->debugInfo);
}
?>
The specification they provide (http://developer.lovefilm.com/ - registration req) says I should POST a request similar to the one below:
POST /oauth/request_token HTTP/1.1 Host: openapi.lovefilm.com Authorization: OAuth oauth_callback="http%3A%2F%2Fyour-service.com%2Fsuccess", oauth_consumer_key="2blu7svnhwkzw29zg7cwkydn", oauth_nonce="5f38dbc02a97567965f14d", oauth_signature="sPSVmqN%2FXu9k0wlZxF0PqPZwYGo%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1278499295", oauth_version="1.0"
However when I use the the method:
$oauth->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
The request that is generated is always a GET.
Can anyone help?
Thanks,
Ben