13
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Error: An AuthUI instance already exists for the key "[DEFAULT]"の対処法

Last updated at Posted at 2019-08-13

SPAFirebase AuthUIを扱う際に

Error: An AuthUI instance already exists for the key "[DEFAULT]"

と表示されることがある。問題のコードは↓である。

const ui = new firebaseui.auth.AuthUI(firebase.auth())
ui.start('#firebaseui-auth-container', uiConfig)

すでにAuthUIが存在しているにもかかわらず、ui.delete()を呼ばず、再びnewしてしまっているのが問題のようだ。
かんたんな対処としては、↑のコードを

const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(firebase.auth())
ui.start('#firebaseui-auth-container', uiConfig)

↑のようにすればよい:thumbsup:

参考: Error: An AuthUI instance already exists for the key "[DEFAULT]"

13
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?