question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue router problem: "An AuthUI instance already exists"

See original GitHub issue

I have a problem with Vue-router and the firebaseui-web.

The first time I open the login page it works. The second time I get the error:

[Vue warn]: Error in mounted hook: “Error: An AuthUI instance already exists for the key “[DEFAULT]””

Here’s my Login page vue component:

let firebaseui = require('firebaseui')
export default {
  data () {
    return {}
  },
  mounted () {
    // FirebaseUI config.
    let uiConfig = {
      signInSuccessUrl: '#/admin',
      signInOptions: [
        // Leave the lines as is for the providers you want to offer your users.
        window.firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      ],
      // Terms of service url.
      tosUrl: ''
    }
    // Initialize the FirebaseUI Widget using Firebase.
    let ui = new firebaseui.auth.AuthUI(window.firebase.auth())
    // The start method will wait until the DOM is loaded.
    ui.start('#firebaseui-auth-container', uiConfig)
  },
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

30reactions
xaksiscommented, Jan 29, 2018

@mesqueeb just do:

    let ui = firebaseui.auth.AuthUI.getInstance();
    if (!ui) {
      ui = new firebaseui.auth.AuthUI(window.firebase.auth());
    }
    ui.start('#firebaseui-auth-container', uiConfig);
3reactions
pydannycommented, Apr 26, 2018

This worked for me:

    let ui = firebaseui.auth.AuthUI.getInstance()
    if (!ui) {
      ui = new firebaseui.auth.AuthUI(firebase.auth())
    }
    ui.start('#firebaseui-auth-container', uiConfig)

Note that I’m not storing anything in window.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in mounted hook: "Error: An AuthUI instance already exists
So far I got sign in and sign up to work with no problems. The issue I am having now is with Social...
Read more >
Error: An AuthUI instance already exists-Vue.js - appsloveworld
Coding example for the question Error in mounted hook: "Error: An AuthUI instance already exists-Vue.js.
Read more >
Developers - Vue router problem: "An AuthUI instance already exists" -
I have a problem with Vue-router and the firebaseui-web. The first time I open the login page it works. The second time I...
Read more >
Error an Authui Instance Already Exist - Lua Software Code
Error: An AuthUI instance already exists for the key "[DEFAULT]". Solution. const ui = firebaseui.auth.AuthUI.
Read more >
Error: An AuthUI instance already exists for the key "[DEFAULT]"
Code. Language: JavaScript. // One-liner that solves this issue: var ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found