Anonymous login with firebase failed

Hi there,

I simply tried to use the firebase anonymous login catching the app activity. I enabled the login function in firebase console as well.
I created the following small function calling the firebase instance and get the signInAnonymously() method:

Future fireAuth() async {
  await FirebaseAuth.instance.signInAnonymously();
  print('Auth successful.');
}

I inserted the function call into the main.dart initState() method to call it anytime the app will launched.

Unfortunately the method will called but every time with an unsatisfied error message:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: PlatformException(ERROR_INTERNAL_ERROR, An internal error has occurred, print and inspect the error details for more information., null)

Has anyone the same issue?
Thanks in advance.

Hello, could you get the error details? I.e. with a try/catch guard?
I’d also add a void type to the async function:

Future<void> fireAuth() async {
  try {  
    await FirebaseAuth.instance.signInAnonymously();
    print(‘Auth successful.’);
  } catch (err) {
    print(err);
  }
}

hth

Again a bad error message with that code:

flutter: PlatformException(ERROR_INTERNAL_ERROR, An internal error has occurred, print and inspect the error details for more information., null)

I see, after the error does it prints the error-stack too?

No, nothing error stack. Thats why I am frustrated more and more.

Yep, that’s annoying indeed. I guess you could try posting the offending code (most of it). Are we even sure the problem is with signInAnonymously()? Sorry if I cannot be more helpful atm (btw I have little experience with Dart/Flutter, so maybe some better help will come!). In the meantime, for learning purpose, I’m going to build a proof of concept app just to accomplish the anonymous Firebase login. Will let you know it I got something working out of it.

Thank you for your help!
As of today that is the only code regarding the Firebase Auth stuff.
Maybe somebody has the same issue …

You are welcome, it is a good way for me to learn more about using Firebase with Flutter, and also I’m desperately procrastinating to start boxing my stuff for a next to come relocation :sweat_smile: :grimacing:

Follow-up

I build a test app, along with the tutorial

Using:

  • Flutter Channel stable, v1.17.1, with the dependencies
  • firebase_core: 0.4.4+3 and firebase_auth: 0.14.0+9.

I enabled the Sign-in method : Anonymous in Firebase Console Authentication configuration.

The anonymous login completed successfully.

Now it’s time to :books: :package: :package: :package: no more excuses :persevere:

Maybe I should try to implement this StreamBuilder.
I will try it and write my results here again.

1 Like