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.
I am trying to login with the following way from inside a plugin class.pmFunctions.php file
1- I am getting the user uid from the session.
2- using user uid fetching all user info from the database.
3- fetching username, password in md5 form.
3- log in with curl to get the access token.

The problem is I want to log in using hashed password and it does not seem to work for me I took the code from a colleague according to him it works just fine on his server, but when I use normal password string it works just fine
Code: Select all

$pstParams = array(
            "grant_type"    => "password",
            "scope"         => "*",
            "client_id"     => "clientId",
            "client_secret" => "clientSecret",
            "username"      => $username,
            "password"      => "md5:".$hashedPassword

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_POST,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $pstParams);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);

        $response = json_decode($response);

This is the response I am getting
Code: Select all
stdClass Object
    [error] => invalid_grant
    [error_description] => Invalid username and password combination

How i can solve this problem to login with out asking for password just to use the hashed password from thE database?
You can login with a hashed password when using web services. See: ... e_Database

However, oAuth2 (which is the login method used by ProcessMaker's REST API) doesn't support login with a hashed password, so you will need to know the user's real password.

If you want to obtain the access token to make REST calls in your plugin, see:

sorry it didn't get attach first time mysql-erro[…]

Hi guys, Im using process maker 3.3.6-1 community […]

We are using the SAML plugin (see screenshot). Do[…]

Hi, I'm having some issues with the Android app. I[…]