Multi tenant app

Hi, I need to develop a multi-tenant app.
The idea is to add an “account” field to login form (so the fields are: account, username, password), and to change the connection string after receiving login form to point to the tenant specific database (mymultitenantappdb_account1, mymultitenantappdb_xyz, mymultitenantappdb_mycustomer10, etc.)
I need to manage the third field in the login process for web app and for api too.
Any experience on how to do this?

Please look at the User_Validated server event where you can add current user profile object. You can then use the Database_Connecting server event to switch database based on the current user profile.

Thank you Michael. In my scenario the users are in the tenant database, so I can’t login without first changing the connection string.
So I have to modify the source to manage the account field in the login form.