I'm building an app using PolymerFire, since PolymerFire doesn't features functionality to connect to Firebase Storage yet I'm facing some problems.
In my index.html
file, I initialize the Firebase app using <firebase-app>
:
<firebase-app
name="myApp"
api-key= "eriqujhiurehuioöwqoerghowöe4rqgeäfwh"
auth-domain= "myapp-123.firebaseapp.com"
database-url= "https://myapp-123.firebaseio.com"
>
</firebase-app>
The problem is, that I can't use firebase.storage()
with this.
It looks like I have to add a second app initalization with the common configs:
<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
<script>
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
storageBucket: "<BUCKET>.appspot.com",
};
firebase.initializeApp(config);
</script>
But this initializes the same app twice right? So this looks just wrong in my eyes.
I have somewhere deeper in my files tree a custom component which is supposed to upload images. I'm able to do so with the two app init method when it stands alone, but not when it's nested in the application.
It would take way too long to explain all the different variations I tried. So my question is, what's the best practice for connecting to Firebase Storage when using PolymerFire?
Any help would be greatly appreciated. :-)
EDIT:
I maged to get it work inside the application now with the two app init method, but this still feels wrong.