Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#790674
I am trying to connect to ProcessMaker using REST API calls via Ruby. I can generate the appropriate requests and test those requests via the Advanced Rest Client. I am using a call to OAuth to get a token that will be used to access data in the database. Whenever I post it get :

"error":"invalid_request","error_description":"The grant type was not specified in the request"
#790675
You are not setting your grant_type or scope correctly when obtaining your access token. You need to send this information to obtain the token:
Code: Select all
{
    "grant_type": "password",
    "scope": "*",      
    "client_id": "XXXXXXXXXXXXXXXXXXXXXXX",
    "client_secret": "XXXXXXXXXXXXXXXXXXXXXX",
    "username": "jdoe",
    "password": "p4sSw0rd"
}
#790677
This is the body of the post:

{"grant_type":"password","scope":"*","client_id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","client_secret":"YYYYYYYYYYYYYYYYYYYYYYYYY","username":"admin","password":"admin"}

Using this same data in the Advanced REST Client is successful. Perhaps it is an issue with how Ruby is formating the post data.
#790744
Here is the information from debugging my calls to the OAuth page:

[2017-05-10 21:22:42.165] DEBUG Sending post request to http://XX.XX.XXX.XXX:8080/workflow/oauth2/token with body: {"grant_type":"password","scope":"*","client_id":"ORFAVREOUWRAUGGRQJGTNKDRHKBSETWT","client_secret":"434157704590a695188bf57026369405","username":"pwaller","password":"welcome"} and headers:
http://52.39.212.230:8080/workflow/oauth2/token

{"grant_type":"password","scope":"*","client_id":"ORFAVREOUWRAUGGRQJGTNKDRHKBSETWT","client_secret":"434157704590a695188bf57026369405","username":"pwaller","password":"welcome"}
[2017-05-10 21:22:42.303] INFO POST http://52.39.212.230:8080/workflow/oauth2/token -- (0.13s) 400 {"error":"invalid_client","error_description":"The client credentials are invalid"} {"date"=>"Wed, 10 May 2017 21:22:42 GMT", "server"=>"Apache/2.4.6 (CentOS) PHP/5.4.16", "x-powered-by"=>"PHP/5.4.16", "access-control-allow-origin"=>"*", "vary"=>"Accept", "cache-control"=>"no-store", "content-length"=>"83", "connection"=>"close", "content-type"=>"application/json"}

It appears to me that the content-type is set to application/json and the body is valid json, includes the grant_type. The user id and password are valid and can log into ProcessMaker. The user is an Administrator.

Any ideas would be appreciated.
BPMN project disappeared

Hi there, I'm new with ProcessMaker, using commu[…]

Hello, Since the web site "https://www.pmuse[…]

Same issue as here.. there was no problem on the l[…]

Hello, Since a while, the link "https://www.[…]