So you are asking the same question as Keycloak API Rest - check if password is correct?
A very convoluted way to get to that point, however, the answer by @dasniko still applies. Don’t. Use the required action flow and let Keycloak handle the messing with credentials part.