Home > Software engineering >  How can I use firebase without the emulator?
How can I use firebase without the emulator?

Time:01-08

I am learning firebase and I checked this tutorial regards the authentication. (At least one provider is switched on

Step 3. Your code looks good.

I assume you have set up auth correctly - we can't see that in the snippet above.

Please paste into your question the exact error message you are seeing on the console, as text.

You might want to intensify the debugging as follows:

function func() {
    console.log(`user: ${JSON.stringify(user,null,2)}`)
    createUserWithEmailAndPassword(auth, user.email, user.password)
    .then((userCredential) => {
        console.log(`userCredential.user: ${JSON.stringify(userCredential.user,null,2)}`)
    })
    .catch((error) => {
        console.error(error)
    });         
}

A small thing, but I suggest avoiding using the same variable name, user, for two different things. Javascript will keep them separate, but we as programmers sometimes will get muddled when looking back at the code.

Step 4. Make sure you have authorised the domain you are using.

Go to:

Only localhost is authorised

If your app is running on "127.0.0.1" instead of "localhost", you might need to add that IP address too. Or if you have deployed, the deployed domain.

CodePudding user response:

Update: my project does not work ON THE EMULATOR. With real devices it works.

  • Related