OpenID login example

I have successfully set up keycloak and added a keycloak user to my AS db. I want to login this user using the API /api/internal/oidc/login endpoint which requires code and state. Can tou provide me of an example how to obtain these values and pass them to the request?