1

I have a Flutter App that I'm simply building to web. I use pretty much the whole suite of Firebase tools. What happens is that whenever I try to call the any signIn method e.g. signInAnonymously or signInWithEmailAndPassword, I get an [firebase_auth/argument-error].

Regular firebase calls, like Firestore get() or update() are working fine.

This is my pubspec.yaml:

  firebase_auth:
  firebase_auth_web:
  firebase_core:
  firebase_core_web: ^1.7.3
  firebase_storage:
  firebase_analytics:
  firebase_dynamic_links:
  firebase_messaging:
  cloud_firestore:
  cloud_firestore_web:
  cloud_functions:

I initialize Firebase like this in main.dart

  if (Constants.BUILD_FOR_WEB) {
    await Firebase.initializeApp(
      options: const FirebaseOptions(
        apiKey: '',
        authDomain: '',
        projectId: '',
        storageBucket: '',
        messagingSenderId: '',
        appId: '',
      ),
    );
  } else {
    await Firebase.initializeApp();
  }

Note: I removed all firebase configurations from index.html because I read that it isn't needed anymore. Since firestore calls worked after removing, I figured it was true.

What I am doing is simply calling my anonymousSignUp() function:

import 'package:firebase_auth_web/firebase_auth_web.dart' as authWeb;
import 'package:firebase_auth/firebase_auth.dart' as auth;
Future<void> anonymousSignUp() async {
  try {
    if (Constants.BUILD_FOR_WEB) {
      await _authWeb.signInAnonymously();
    } else {
      await _auth.signInAnonymously();
    }
      
  } catch (e) {
    print(e);
  }
}

I get an [firebase_auth/argument-error], nothing more. No console output, nothing in the network tab either. I don't know what to do. If anybody has a clue, I'm incredibly thankful for everything.

nicklbaert
  • 57
  • 2
  • 7

0 Answers0