- Fri Sep 21, 2018 4:36 pm
#816222
I am using React to create an application and I require to implement single sign on in it. I went through the processmaker documentation and found a method to get access_token for autologin .However, I want to use a password from my database for the specific user who is currently logged in . Since the passwords are hashed and saved in the database, my response is incorrect. Is there a way to pass the hashed password and get the response appropriately.
here is my code
var req = new XMLHttpRequest()
var data = JSON.stringify({
"grant_type": "password",
"scope": "*",
"client_id": "GVCTZYMGEURRYPNYWCKNBLELCKDECFDP",
"client_secret": "5919799805ba10487e631f5001254717",
"username":username,
"password":password
})
req.open('POST', 'http://192.168.0.198/workflow/oauth2/token');
req.setRequestHeader('Content-type', 'application/json');
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
console.log(req.responseText);
var response = JSON.parse(req.responseText);
console.log(response.access_token)
}
}
req.send(data);
It works fine when I use unhashed password, but it does not work if I use the hashed one from the database
here is my code
var req = new XMLHttpRequest()
var data = JSON.stringify({
"grant_type": "password",
"scope": "*",
"client_id": "GVCTZYMGEURRYPNYWCKNBLELCKDECFDP",
"client_secret": "5919799805ba10487e631f5001254717",
"username":username,
"password":password
})
req.open('POST', 'http://192.168.0.198/workflow/oauth2/token');
req.setRequestHeader('Content-type', 'application/json');
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200) {
console.log(req.responseText);
var response = JSON.parse(req.responseText);
console.log(response.access_token)
}
}
req.send(data);
It works fine when I use unhashed password, but it does not work if I use the hashed one from the database