ReactApp connecting to MongoDB via C# API, authentication issues with RealmCLI

Hi,

I am fairly new to MongoDB, and we are having an issue with knowing what the right and wrong ways are for authenticating our app with MongoDB.

We have a React front end, a C# API communication layer and a MongoDB backend. What we want to do, is have a user go through authentication via the client, which when they have logged in, get access to a specific database within our MongoDB cluster, and that DB only. We have set up some database access roles in the main ui, which allows this set user to read/write that specific database, but then we have also setup a App Service too via the RealmCLI, and this is where we are getting into difficulties. We seem to only be able to allow access to ALL DBs and then set rules per collection. So if we didnt want all users to know all DB names, we would have to create a new app for each org that logs in.

I am not sure if we are over complicating this but some help / guidance would be great.

We want to create all the DBs and collections, and set the roles / users / rules that have access to the DB ideally via the CLI / SDK as this is a Saas app for many customers and I dont want to have to do this manually on each DB every time a customer signs up.

Thanks in advance