Reputation: 3
I have been trying to implement firebase auth to my Unity project but I always get the same error when I'm trying to log into a test account I made in firebase console:
An internal error has occurred
The function that gets called when I click the button is:
public async void LoginButton()
{
await SignIn(emailField.text, passwordField.text);
}
And the function SignIn is the following:
public async Task<bool> SignIn(string email, string password)
{
try
{
var result = await auth.SignInWithEmailAndPasswordAsync(email, password);
user = result.User;
Debug.Log($"User signed in successfully: {user.Email}");
return true;
}
catch (FirebaseException e)
{
Debug.LogError($"Failed to sign in: {e.Message}");
return false;
}
}
Firebase is already setup correctly and I have put the Google-services file in my unity project in the path Assets/Firebase.
I have tried simply leaving the fields blank to see if I would get a different error and if I leave the email blank I do get a different error, I get E-mail is not formatted correctly, so I don't think the error is caused by the function in itself, it could be an issue in firebase, but I have no idea how to diagnose the error in firebase, but everything is setup correctly and the E-mail/Password method is active.
Edit:
Here is the full call stack:
Failed to sign in: An internal error has occurred. 0x00007ffca537616d (Unity) StackWalker::ShowCallstack 0x00007ffca5386129 (Unity) PlatformStacktrace::GetStacktrace 0x00007ffca65ef76e (Unity) Stacktrace::GetStacktrace 0x00007ffca6b97faf (Unity) DebugStringToFile 0x00007ffca44a1625 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x000001d51f42e8cd (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log_Injected (UnityEngine.LogType,UnityEngine.LogOption,UnityEngine.Bindings.ManagedSpanWrapper&,intptr) 0x000001d51f42e793 (Mono JIT Code) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) 0x000001d51f42e3cb (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 0x000001d51f42e150 (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object) 0x000001d5c3016055 (Mono JIT Code) UnityEngine.Debug:LogError (object) 0x000001d5c300fe2b (Mono JIT Code) Auth/d__7:MoveNext () (at ***/Assets/Scripts/Auth.cs:56) 0x000001d4d8d28cd2 (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object) 0x000001d4477c5cfe (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4477c586b (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4d8d28b8b (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run () 0x000001d5c30157aa (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object) 0x000001d4f9977e05 (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&) 0x000001d4f9977a73 (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool) 0x000001d448a50e33 (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations () 0x000001d448a50a63 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree () 0x000001d448a503f3 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo () 0x000001d448a5004b (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool) 0x000001d5c30146bb (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object) 0x000001d5c3015ecb (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1<TResult_REF>:SetException (System.Exception) 0x000001d5c301028b (Mono JIT Code) Firebase.Auth.FirebaseAuth/<SignInWithEmailAndPasswordAsync>d__51:MoveNext () 0x000001d4d8d28cd2 (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object) 0x000001d4477c5cfe (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4477c586b (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4d8d28b8b (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run () 0x000001d5c30157aa (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object) 0x000001d4f9977e05 (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&) 0x000001d4f9977a73 (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool) 0x000001d448a50e33 (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations () 0x000001d448a50a63 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree () 0x000001d448a503f3 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo () 0x000001d448a5004b (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool) 0x000001d5c30146bb (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object) 0x000001d5c30145ab (Mono JIT Code) System.Threading.Tasks.TaskCompletionSource
1<TResult_REF>:TrySetException (System.Exception) 0x000001d5c30144f3 (Mono JIT Code) System.Threading.Tasks.TaskCompletionSource1<TResult_REF>:SetException (System.Exception) 0x000001d5c3013dd3 (Mono JIT Code) Firebase.Auth.Future_AuthResult/<>c__DisplayClass5_0:<GetTask>b__0 () 0x000001d5c301331d (Mono JIT Code) Firebase.Auth.Future_AuthResult:SWIG_CompletionDispatcher (int) 0x000001d5c301255b (Mono JIT Code) (wrapper native-to-managed) Firebase.Auth.Future_AuthResult:SWIG_CompletionDispatcher (int) 0x00007ffcc4daee18 (FirebaseCppApp-12_5_0) 0x00007ffcc4e0d718 (FirebaseCppApp-12_5_0) uS::Socket::freeMessage 0x000001d5c0841657 (Mono JIT Code) (wrapper managed-to-native) Firebase.AppUtilPINVOKE:PollCallbacks () 0x000001d5c084156b (Mono JIT Code) Firebase.AppUtil:PollCallbacks () 0x000001d5c084150b (Mono JIT Code) Firebase.Platform.FirebaseAppUtils:PollCallbacks () 0x000001d5c0841153 (Mono JIT Code) Firebase.Platform.FirebaseHandler:Update () 0x000001d5c084100b (Mono JIT Code) Firebase.Platform.FirebaseMonoBehaviour:Update () 0x000001d57f6c77e8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007ffcb9c8697e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445) 0x00007ffcb9bc8444 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068) 0x00007ffcb9bc8530 (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115) 0x00007ffca529a1a4 (Unity) scripting_method_invoke 0x00007ffca5272073 (Unity) ScriptingInvocation::Invoke 0x00007ffca525d1e4 (Unity) MonoBehaviour::CallMethodIfAvailable 0x00007ffca525d312 (Unity) MonoBehaviour::CallUpdateMethod 0x00007ffca4c8937c (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager> 0x00007ffca4c909aa (Unity) BehaviourManager::Update 0x00007ffca4f19a7d (Unity)
InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward 0x00007ffca4ee7cc7 (Unity) ExecutePlayerLoop 0x00007ffca4ee7e37 (Unity) ExecutePlayerLoop 0x00007ffca4eecf6f (Unity) PlayerLoop 0x00007ffca5feda9a (Unity) EditorPlayerLoop::Execute 0x00007ffca6004937 (Unity) PlayerLoopController::InternalUpdateScene 0x00007ffca60066ed (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop 0x00007ffca60004f1 (Unity) Application::TickTimer 0x00007ffca65f447a (Unity) MainMessageLoop 0x00007ffca65fa152 (Unity) UnityMain 0x00007ff76afa2fba (Unity) __scrt_common_main_seh 0x00007ffd7190259d (KERNEL32) BaseThreadInitThunk 0x00007ffd7340af38 (ntdll) RtlUserThreadStart
Upvotes: 0
Views: 39
Reputation: 3
Ok I have finally fixed the issue, the issue was that my textboxes where not formatting the string correctly, after trimming the string it now works flawlessly, I also, for good measure, replaced with regex invalid characters, but I would say that this is a bit overkill, anyways, problem solved.
Upvotes: 0