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.

Firebase auth PROVIDER_ID is undefined

See original GitHub issue
  • Operating System version: macOS High Sierra 10.13.6
  • Browser version: Chrome Version 68.0.3440.106
  • Firebase UI version: firebaseui 3.4.1
  • Firebase SDK version: 5.5.0
  • Node: 8.11.1

I’m using react 16.5.0 and receiving the following error “Cannot read property ‘PROVIDER_ID’ of undefined”

I initialize firebase in a config file and import firebase and firebaseui like so

import firebase from '../config.js';
import firebaseui from 'firebaseui';

I’m able to use firebase.auth() in the same file. So I know firebase was initialized and is working.

firebase.auth().signInWithEmailAndPassword(username, password)

I enabled the Email/Password signin provider in the project console. Below is the code that I have in my componentDidMount() method.

 var uiConfig = {
      signInSuccessUrl: '/home',
      signInOptions: [firebase.auth.EmailAuthProvider.PROVIDER_ID]
 }

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

Is anyone else running into this or have an idea what’s going on?

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
joshkuharcommented, Sep 18, 2018

@wti806 You are correct! I’m not sure why the auth() was working after initializing firebase and then exporting. I exported the config object and then initialized in the component. Thanks!

'use strict';

import React, {Component} from 'react';
import config from '../config.js';
import * as firebase from 'firebase';
import * as firebaseui from 'firebaseui';

const db = firebase.initializeApp(config);

const uiConfig = {
    signInSuccessUrl: '/',
    signInOptions: [ firebase.auth.EmailAuthProvider.PROVIDER_ID ],
    tosUrl: '/'
};

class Login extends Component {
    constructor(props) {
        super(props)
        this.state = {
            error: ''
        }
    }
    componentDidMount() {
        var ui = new firebaseui.auth.AuthUI(firebase.auth());
        ui.start('#firebaseui-auth-container', uiConfig);
    }
    render() {
        return <div id="firebaseui-auth-container"></div>
    }
} 

export default Login;
0reactions
wti806commented, Sep 18, 2018

@joshkuhar Don’t you need to export the firebase object from config.js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot read property 'PROVIDER_ID' of undefined" error on ...
PROVIDER_ID ], tosUrl: "http://howlbits.com" }; // Initialize the FirebaseUI Widget using Firebase. var ui = new firebaseui.auth.
Read more >
Javascript html firebase returning undefined - Stack Overflow
1 Answer 1 ... As explained in the doc, " currentUser might be null because the auth object has not finished initializing". ......
Read more >
Admin Authentication API Errors | Firebase - Google
The providerId must be a valid supported provider identifier string. auth/invalid-oauth-responsetype, Only exactly one OAuth responseType should be set to true.
Read more >
capacitor-firebase/authentication - NPM Package Overview
This plugin enables the use of Firebase Authentication in a Capacitor app. It uses the Firebase SDK for Java (Android), Swift (iOS) and ......
Read more >
useAuth | VueUse
useAuth. Reactive Firebase Auth binding. It provides a reactive user and isAuthenticated so ... boolean | undefined) => Promise<string> isAnonymous: boolean ...
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