Skip to content

Firebase Emulator with Capacitor live reload #460

Closed Answered by djabif
djabif asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you so much for your help Robin, I was able to make it work 👏🏼 🙏🏻

My problem was the http, it's only needed in the web environment, not in capacitor.
So my final initialization method looks like this:

public async initialize(): Promise<void> {
    const host = this.platform.is('capacitor') ? `${location.hostname}` : `http://${location.hostname}`;

    if (!this.platform.is('capacitor')) {
      /* Only needed if the Firebase JavaScript SDK is used.
       Read more: https://github.com/robingenz/capacitor-firebase/blob/main/packages/authentication/docs/firebase-js-sdk.md */
      initializeApp(environment.firebase);
    }
    await FirebaseAuthentication.useEmulator({
      host: host,

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@djabif
Comment options

Answer selected by robingenz
@robingenz
Comment options

@robingenz
Comment options

@djabif
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants