OAuth 2 framework for OPS v 3.1
Posted: Wed Aug 28, 2013 8:32 am
I need some help to use the OAuth 2 framework in my OPS software, implemented with cUrl calls in PHP.
Which OAuth.php library can I use?
How does the mechanism to gain the accestoken, looks like.
I've tried:
==========================================================================
require_once('OAuth.php');
...
$CONSUMER_KEY=".......";
$CONSUMER_SECRET=".........";
$consumer=new OAuthConsumer($CONSUMER_KEY, $CONSUMER_SECRET);
...
$request = OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET', $rest_url, NULL);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$auth_header = $request->to_header();
....
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array($auth_header));
...
$result=curl_exec($curl);
====================================================================
Which OAuth.php library can I use?
How does the mechanism to gain the accestoken, looks like.
I've tried:
==========================================================================
require_once('OAuth.php');
...
$CONSUMER_KEY=".......";
$CONSUMER_SECRET=".........";
$consumer=new OAuthConsumer($CONSUMER_KEY, $CONSUMER_SECRET);
...
$request = OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET', $rest_url, NULL);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$auth_header = $request->to_header();
....
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array($auth_header));
...
$result=curl_exec($curl);
====================================================================