- Thu Apr 18, 2019 6:25 am
#824046
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
How i can solve this problem to login with out asking for password just to use the hashed password from thE database?
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
This is the response I am getting
$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);
curl_close($ch);
$response = json_decode($response);
var_dump($response);
}
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?