Hi @OdMa
There are currently two commonly used user-based authentication flows:
One is to use browser interactive authentication, the user must log in in the browser window, i.e. auth code flow.
The other is to hard-code the username/password of the target user on the server side, i.e. ROPC flow.
ROPC flow does not require your users to log in interactively in the browser. From the perspective of convenience, it is obviously better than auth code flow. But it requires you to know the target user's username/password, which doesn't seem to apply in your context.
To sum up, I think the easiest way is to set up your app as a multi-tenant app, then join the multi-tenant app as an enterprise app to the target company's tenant. After that, you will be able to use the unattended client credentials flow to manage users in the target tenant.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.