How to programmatically obtain a bearer token

I’ve done a ton of research and need to ask for help. I’m looking to automate the setup of home assistant. Part of this would be allowing an application to call the API. In order to do this, I need a bearer token.

I can’t find a way to do this programmatically without going through the UI for a long lived token.

When I follow the steps here: Authentication API | Home Assistant Developer Docs
I get a 400 error stating “invalid client id” calling /auth/token. I’m not seeing how I would register a client id for my own app.

Thank you for any help!

Did you ever find a solution?