#StackBounty: #javascript #firebase-authentication #firebaseui Firebase UI: updateCurrentUser failed: First argument "user" m…

Bounty: 100

I recently updated to firebase 8, and related deps including firebaseui 4.8.1 (I have tried several versions, they all give me this error). It loads a login box, but when trying to enter creds or create a new user, I get this error:

updateCurrentUser failed: First argument "user" must be an instance of Firebase User or null.

How can I restore the auth functionality?

firebase.js

import firebase from 'firebase/firebase';
import '@firebase/firestore';
import { FIREBASE_CONFIG } from '../keys';

const config = FIREBASE_CONFIG;

export const firebaseApp = firebase.initializeApp(config);
export const db = firebaseApp.firestore();

/store/index.js (abbreviated)

import firebase from 'firebase/firebase';
import * as firebaseui from 'firebaseui';
import '@firebase/firestore';

// This is our firebaseui configuration object
const uiConfig = ({
    signInSuccessUrl: '',
    signInOptions: [
        firebase.auth.EmailAuthProvider.PROVIDER_ID,
    ],
    callbacks: {
        signInSuccessWithAuthResult: authResult => {
            store.dispatch(login(authResult));
        },
    },
});

// This sets up firebaseui
const ui = new firebaseui.auth.AuthUI(firebase.auth());

// This adds firebaseui to the page
export const startFirebaseUI = elementId => {
    ui.start(elementId, uiConfig);
};

package.json

    "firebase": "^8.8.0"
    "firebaseui": "^4.8.1",

I have tried solutions suggested in these discussions, but they are not working for me.
https://github.com/firebase/firebaseui-web/issues/536
https://github.com/firebase/firebaseui-web/issues/776

I’m seeing what looks like a valid auth response in the console too. Here is the verifyPassword response:

{
  "kind": "identitytoolkit#VerifyPasswordResponse",
  "localId": "VgZWszYv8cYDJLQsIr3YzwcZJ4s1",
  "email": "user@gmail.com",
  "displayName": "My User",
  "idToken": "<<a_long_token>>",
  "registered": true,
  "refreshToken": "<<another_token>>",
  "expiresIn": "3600"
}

Here is the getAccountInfo response:

{
  "kind": "identitytoolkit#GetAccountInfoResponse",
  "users": [
    {
      "localId": "VgZWszYv8cYDJLQsIr3YzwcZJ4s1",
      "email": "user@gmail.com",
      "displayName": "Me",
      "passwordHash": "<<a hash>>",
      "emailVerified": false,
      "passwordUpdatedAt": 1561313504412,
      "providerUserInfo": [
        {
          "providerId": "password",
          "displayName": "Me",
          "federatedId": "user@gmail.com",
          "email": "user@gmail.com",
          "rawId": "user@gmail.com"
        }
      ],
      "validSince": "1561313504",
      "lastLoginAt": "1627418219738",
      "createdAt": "1561313504412",
      "lastRefreshAt": "2021-07-27T20:36:59.738Z"
    }
  ]
}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.