I’m working with Firebase Web. I'm using multiple databases in the same project for scalability purposes. I’m not sure how to connect to a secondary database (this will be a dynamic DB) with the current authenticated user?
This is my current code:
let secondary_app = firebase.initializeApp(
{ ...config, databaseURL: secondaryDbUrl },
"secondary_app"
);
let query = firebase.database(secondary_app).ref(rtdbPath);
But this won't have the current user's authentication and hence all security rules that require auth fail.
The problem is that my secondary Db URLs are dynamic and I have to do reinitialization multiple times in the code. Should I have to sign in into the secondary app instance every time I create a secondary app through firebase.initializeApp?
Non-web SDKs seem to have a much easier approach where you are allowed to enter the Database URL directly into firebase.database() as an argument. Does a similar easier approach exist for Web SDK? Thanks for the help in advance!