Automate Access Control and API key creation

So what I am looking for is something that this post suggests: Custom username and password for API access but am not quite sure it’s the correct approach here. Or I might be wrong?

Basically what I’d like to achieve is to lock the UI down via localauthconfig API call and then generate the API key for that user (that is going to be an admin user ofc) I’ve created with the previous API call. But in order to create an API key for that user I seem nee dto provide ${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY} that I do not have yet, so to me it seems like chicken and the egg problem? Or am I on the wrong track here?