User password from api

Hello friends,

I fixed 401 error building my script:

KEYCLOAK=http://localhost:8180
REALM=“master”
GRANT_TYPE=“password”
CLIENT=“admin-cli”
#CLIENT_SECRET=“b38eae9d-d5ef-4a98-b1e6-6b5084b09d91”
USER=“admin”
USER_PASSWORD=“Qazx1234”

echo “Keycloak host : $KEYCLOAK”
echo “Token URL : ${KEYCLOAK}/auth/realms/${REALM}/protocol/openid-connect/token”

#Get Token
#POST_BODY=“grant_type=${GRANT_TYPE}&client_id=${CLIENT}&client_secret=${CLIENT_SECRET}&username=${USER}&password=${USER_PASSWORD}”
POST_BODY=“grant_type=${GRANT_TYPE}&client_id=${CLIENT}&username=${USER}&password=${USER_PASSWORD}”

#echo POST_BODY=${POST_BODY}

RESPONSE=$(curl -k
-d ${POST_BODY}
-H “Content-Type: application/x-www-form-urlencoded”
${KEYCLOAK}/auth/realms/${REALM}/protocol/openid-connect/token)

#echo “RESPONSE”=${RESPONSE}
ACCESS_TOKEN=$(echo ${RESPONSE} | jq -r .access_token)

echo $ACCESS_TOKEN

curl PUT ‘http://localhost:8180/auth/admin/realms/Testkeycloak/users/b8f6beac-ecdf-441e-959c-4c9498ecb007/reset-password
–header ‘Accept: application/json’
–header “Authorization: Bearer ${ACCESS_TOKEN}”
–header ‘Content-Type: application/json’
–data-raw ‘{
“type”: “password”,
“temporary”: false,
“value”: “qaz1234”
}’
~

As you can see my token is from admin user and master realm. And PUT url contains “auth/admin”, I tried without “admin” too.

Now I got {“error”:“RESTEASY003650: No resource method found for POST, return 405 with Allow header”}

Finally is possible to change the password with a curl command ? or it is possible only with api ? User Password Change Programatically - #9 by gmesml