Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] An internal error has occurred on Authentication #1220

Closed
RafaelGomes00 opened this issue Mar 16, 2025 · 18 comments
Closed

[Bug] An internal error has occurred on Authentication #1220

RafaelGomes00 opened this issue Mar 16, 2025 · 18 comments

Comments

@RafaelGomes00
Copy link

RafaelGomes00 commented Mar 16, 2025

Description

I use the authentication system on Firebase on my project, and suddendly I started receiving this error:

System.AggregateException: One or more errors occurred. (An internal error has occurred.) ---> Firebase.FirebaseException: An internal error has occurred.
at Firebase.Auth.FirebaseAuth.SignInWithEmailAndPasswordAsync (System.String email, System.String password) [0x00038] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/auth/swig/Firebase.Auth_fixed.cs:3840
--- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: An internal error has occurred.
at Firebase.Auth.FirebaseAuth.SignInWithEmailAndPasswordAsync (System.String email, System.String password) [0x00038] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/auth/swig/Firebase.Auth_fixed.cs:3840 <---

My coworker managed to fix this problem for him just by reinstalling the Firebase SDK, wich did not worked for me.
What I have tried:

  • Reinstalling Firebase entirelly on the project;
  • Downloading the assets directly from my coworker;

Reproducing the issue

I dont know exactly how to reproduce this issue, it suddendly started giving this error, with no connection to any commit, neither SDK update wich has not been made.

Firebase Unity SDK Version

12.7.0

Unity editor version

6000.0.3f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Authentication

Other Firebase Component(s) in use

Analytics, Firestore

Additional SDKs you are using

No response

Targeted Platform(s)

Android, Apple Platforms

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@argzdev
Copy link

argzdev commented Mar 17, 2025

Hey @RafaelGomes00, thanks for reaching out. So far, I've checked our quickstart for Auth and the SignInWithEmailAndPasswordAsync seems to work fine.

Could you double check if you've added the google-services.json? Also could you try using the Asset > External Dependency Manager > Android Resolver > Resolve/Force Resolve and see if that changes anything?

@argzdev argzdev added the needs-info Need information for the developer label Mar 17, 2025
@RafaelGomes00
Copy link
Author

RafaelGomes00 commented Mar 17, 2025

Hello, I double checked it and I have the google-services.json under Assets > Streaming Assets, and also tested outside that scope wich gave me the same error.
Also using Android Resolver > Resolve/Force Resolve dont work either.

I will check using the sample on quickstart for Auth to see if it works

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Mar 17, 2025
@RafaelGomes00
Copy link
Author

I created a new project with only Firebase Auth installed, and used this code to log in:

    [SerializeField] private string email;
    [SerializeField] private string password;

    void Start()
    {
        StartCoroutine(Login(email, password));
    }

    public IEnumerator Login(string email, string password)
    {
        FirebaseAuth auth = FirebaseAuth.DefaultInstance;
        var loginTask = auth.SignInWithEmailAndPasswordAsync(email, password);

        while (!loginTask.IsCompleted)
        {
            yield return null;
        }

        if (loginTask.Exception != null)
        {
            Debug.Log(loginTask.Exception);
        }
        else
        {
            if (!auth.CurrentUser.IsEmailVerified)
            {
                Debug.LogError("User not verified");
                yield break;
            }

            Debug.Log("User logged in");
        }
    }

Wich gave me the same error

@argzdev
Copy link

argzdev commented Mar 17, 2025

Thanks for trying that out. I have a couple more questions, just to make sure we check everything.

Do you have the initialization code for Firebase before calling Auth?

public virtual void Start() {
      Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
        dependencyStatus = task.Result;
        if (dependencyStatus == Firebase.DependencyStatus.Available) {
          InitializeFirebase();
        } else {
          Debug.LogError(
            "Could not resolve all Firebase dependencies: " + dependencyStatus);
        }
      });
    }

Also is the Sign-in provider for Email/Password enabled?

Do you have firewall enabled? If so, you could try whitelisting these endpoints:

identitytoolkit.googleapis.com
securetoken.googleapis.com

So far, I don't see any service disruption in our status dashboard, so I'm guessing it's not an issue on the backend.

@RafaelGomes00
Copy link
Author

About Initialization, I use the same code as you showed, with the only exception that I dont have the "InitializeFirebase()" method. And the Firewall, as I couldnt find how to add these endpoints into windows firewall, I disabled it entirely for testing, and it didnt work as well.

This issue has already been happening to me for about a week, so I dont think it's an issue on the backend of Firebase, as it would have a way bigger impact.

@argzdev
Copy link

argzdev commented Mar 17, 2025

Thanks for getting back to me quickly. Got it, atleast we can cross out it being a network related issue.

We might need to better error code to investigate this, Could you do the following steps:

  1. In the Firebase console, go to the Firebase Auth Settings page. Go to Firebase Auth settings
  2. In the navigation pane, select User actions.
  3. Select Email enumeration protection and temporarily disable it.

For context, this vague error message is due to email enumeration protection. This is usually enabled by default to avoid malicious actor attempts to guess or confirm users in a system by passing an email address to the API and checking the response.

But for now, try disabling it and see if we can get more detail regarding the error, and test it again so we can see what error is being encountered.

@RafaelGomes00
Copy link
Author

RafaelGomes00 commented Mar 17, 2025

I disabled it and since I didnt know how much time it would take to update, I waited a few minutes, but the error I'm receiving the same:

System.AggregateException: One or more errors occurred. (An internal error has occurred.) ---> Firebase.FirebaseException: An internal error has occurred.
at Firebase.Auth.FirebaseAuth.SignInWithEmailAndPasswordAsync (System.String email, System.String password) [0x00038] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/auth/swig/Firebase.Auth_fixed.cs:3840
--- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: An internal error has occurred.
at Firebase.Auth.FirebaseAuth.SignInWithEmailAndPasswordAsync (System.String email, System.String password) [0x00038] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/auth/swig/Firebase.Auth_fixed.cs:3840 <---

Also thanks for helping me out with this problem.

@argzdev
Copy link

argzdev commented Mar 17, 2025

That is odd, does trying a different user email/password also result to the same behavior? Other than that, I don't know if there's anything else that could be causing this. But since I'm unable to reproduce this, it is difficult to say what's causing the behavior. That said, could you provide me an MCVE?

@RafaelGomes00
Copy link
Author

Sorry for the delay, I was setting up another Firebase project for testing that I could send to you.
How can I get you access to the testing project?

@argzdev
Copy link

argzdev commented Mar 18, 2025

Feel free to create a GitHub repo and share the link here. Make sure to remove any PII (Personally identifiable information).

Update: I didn't notice that this issue was on the Windows platform. I was initially investigating an issue related to this #1191. I think both of these are related. Let me reach out to our engineers and have a closer inspection on our Firebase C++ SDK.

@argzdev argzdev added type: bug and removed needs-attention Need Googler's attention labels Mar 18, 2025
@RafaelGomes00
Copy link
Author

RafaelGomes00 commented Mar 18, 2025

Hello, I ended up creating a project.

This project does not have the google-services.json, it only contains a login button that will try to login on an account listed on inspector in "Login" Game object, to create an account I created one directly on firebase just for testing.
EDIT: I removed the project, see next response.

Also I tried updating my project to unity 6000,0,42f1 (LTS) but it didnt work.

And after reading this issue you mentioned I will be testing switching dns and using VPN to see if it changes anything.

@RafaelGomes00
Copy link
Author

RafaelGomes00 commented Mar 18, 2025

Great news!
I have tested it using VPN and it worked normally.
As a side note, I read on that issue that one of the people that was having this problem is from Brazil, and I'm from Brazil as well.

@argzdev
Copy link

argzdev commented Mar 18, 2025

That's good news, at least there's an alternative solution for now. Thanks for adding these additional details. I noticed one of the comments that the issue is related to gRPC.

I discovered that the Windows version uses the Firebase C++ SDK for authentication, and this SDK communicates via gRPC.

In order to maintain a single line of communication. I'll close this thread as a duplicate for now. Feel free to continue your report in #1191, and please do leave a thumbs up on the author's post so we can monitor the severity while investigating. Thanks!

@argzdev argzdev closed this as completed Mar 18, 2025
@argzdev
Copy link

argzdev commented Mar 20, 2025

Hey @RafaelGomes00, there was fix mentioned here. Could you try updating Windows 11 and see if the issue is still persistent? Thanks!

@RafaelGomes00
Copy link
Author

Hi! I am using Windows 10, and after I used VPN that one time to login onto the project, it started working normally without needing to use it again. I can update to windows 11 and see if it works, but I can't guarantee that it would get any useful info, given that it already works normally without external tools.

@RafaelGomes00
Copy link
Author

RafaelGomes00 commented Mar 20, 2025

I also wanted to compact all the info I have regarding this problem:

  • 3 people started having the problem all together, we dont know exactly when it started, only that it was first seen on February 28th. And all 3 people are from Brazil, logging in from either Android device, or Unity Editor.

  • 1 person who could only use the WebGL build and lives on the US could login just fine.

  • The other programmer managed to fix the error for themselves by reimporting firebase SDK's and using Android Resolve/Force resolve, and a few days later it started happening again for him and managed to fix by doing the same thing.

  • For me, reinstalling and recreating files didnt work, even creating a fresh unity project and fresh Firebase project didnt work, the only solution for me was using a VPN that connected to the Netherlands, after that the problem seemed fixed, and I dont need to use VPN to log in anymore.

  • We had not updated Firebase in any way.

  • I can't recal if there was a Windows 10 update before the issue started happening.

@argzdev
Copy link

argzdev commented Mar 21, 2025

These are very useful information, @RafaelGomes00. Thank you for sharing these! We're still not entirely sure what the issue is, but we'll keep an eye out for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants