Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By linqunxun2
#780337
3.0 official document, the specific location is as follows:
IV Programming -.> 1.REST API V1.0 -> 1.1 OAuth 2.0 -> Step 2.Request authorization for an application.
I visited links in the document, try to request authorization, but failed, to ask whether there are links in the document is wrong with it?
User avatar
By liliana
#780374
Could you tell me which version of ProcessMaker 3 are you using? I'm asking you this beacuse between the first beta release and the second beta release some new features were included in our REST.
By linqunxun2
#780385
liliana wrote:Could you tell me which version of ProcessMaker 3 are you using? I'm asking you this beacuse between the first beta release and the second beta release some new features were included in our REST.

Hello, I'm using version is: master.cd92871
User avatar
By liliana
#780423
Did you register the application?

I give you a tip, in this new BETA release a documentation about oauth was included in any installation. Login to ProcessMaker and in the URL use the following:

http://192.168.1.215/workflow/oauth2

If this is not working probably you have to run a command using SSH, the command is
Code: Select all
./processmaker flush-cache 
Run this in the path:

/opt/processmaker

The documentation will guide with the correct URLs you need to use. But mainly you need to register the application otherwise it won't work.

Regards,
By linqunxun2
#780434
Thank you very much, I have to solve this problem.
But in the Exchange Authorization code by an Access Token.
I encountered a new problem,
my url is as follows:
http://192.168.1.215/workflow/oauth2/au ... Test02.php
my code is as follows:
Code: Select all
if (! empty($_GET['error'])) {
    print_r($_GET);
    die();
}
echo $_GET['code'];
$url = "http://192.168.1.215/workflow/oauth2/token";

$postParams = array(
	"grant_type"=>"authorization_code",
	"code"=>$_GET['code'],
	"redirect_uri"=>"http://192.168.2.67/PM3/OAuthTest02.php"
);
$postHeader = array(
 	"Authorization: Basic eC1wbS1sb2NhbC1jbGllbnQ6MTc5YWQ0NWM2Y2UyY2I5N2NmMTAyOWUyMTIwNDZlODE="
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $postHeader);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.2; rv:32.0) Gecko/20100101 Firefox/32.0');

$result = curl_exec($ch);
$data = json_decode($result, true);
var_dump($data);
curl_close($ch);
Returned as follows:
Code: Select all
fbb19bd9aba817189c6b837246c682260a548080

array (size=2)
  'error' => string 'invalid_grant' (length=13)
  'error_description' => string 'authorization_code doesn't exist or is invalid for the client' (length=61)

In "http://tools.ietf.org/html/rfc6749#section-3.2.1" I found a description for this error:
invalid_grant
The provided authorization grant (eg, authorization
code, resource owner credentials) or refresh token is
invalid, expired, revoked, does not match the redirection
URI used in the authorization request, or was issued to
another client.

But my code looks like no problem, I ask what is asked?

Temu New user DIscount code Using Temu's DIscount […]

By using the Temu coupon code [acu600079], you can[…]

Yes, the Temu Coupon Code "aci384098" or[…]

Yes, the Temu Coupon Code "aci384098" do[…]