First functional OAuth2 implementation, but we're still working on it
This commit is contained in:
28
workflow/engine/methods/services/oauth2_grant.php
Normal file
28
workflow/engine/methods/services/oauth2_grant.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
//$host = 'http://pmos/sysworkflow/en/neoclassic/services/oauth2_grant';
|
||||
$host = 'http://pmos/api/1.0/workflow/token';
|
||||
|
||||
$clientId = 'testclient';
|
||||
$secret = 'testpass';
|
||||
|
||||
$data = array(
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $_GET['code']
|
||||
);
|
||||
|
||||
$ch = curl_init($host);
|
||||
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, "$clientId:$secret");
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$return = @json_decode(curl_exec($ch));
|
||||
|
||||
echo '<pre>';
|
||||
print_r($return);
|
||||
|
||||
curl_close($ch);
|
||||
Reference in New Issue
Block a user