"Programatic" PKCE flow

I found an example of PKCE flow in KeyCloak (https://www.stefaanlippens.net/oauth-code-flow-pkce.html) and basically it works as expected. The only problem is that as a part of this flow we need to get login page (from /protocol/openid-connect/auth), parse it in order to get the url of /protocol/openid-connect/authenticate with all its parameters and post username / password to /authenticate. Is there a more “programmatic” way of doing that without dealing with html login page?

Use better OIDC flow for your use case. E.g. Direct Grant Flow if you want to authenticate user or Client Credential Flow if you want to authenticate machine.