Closed
Description
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2022.3.10f1.0.16956
- Firebase Unity SDK version: 11.6.0
- Source you installed the SDK: .unitypackage (.unitypackage or Unity Package Manager)
- Problematic Firebase Component: Auth (Auth, Database, etc.)
- Other Firebase Components in use: Database(Auth, Database, etc.)
- Additional SDKs you are using: _____ (Facebook, AdMob, etc.)
- Platform you are using the Unity editor on: Windows(Mac, Windows, or Linux)
- Platform you are targeting: Android(iOS, Android, and/or desktop)
- Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)
- Pre-built SDK from the website or open-source from this repo: _____
[REQUIRED] Please describe the question here:
I have a problem using LinkWithCredentialAsync
Can you tell me how to Convert an anonymous account to a permanent account in unity? Thank
public async Task ConvertUserWithEmail(string email, string password)
{
Firebase.Auth.FirebaseUser currentUser = Firebase.Auth.FirebaseAuth.DefaultInstance.CurrentUser;
if (currentUser != null)
{
try
{
Firebase.Auth.Credential credential = Firebase.Auth.EmailAuthProvider.GetCredential(email, password);
await currentUser.LinkWithCredentialAsync(credential); //(cs:1881))
warningText.text = "IsCompleted";
}
catch (Exception e)
{
Debug.Log(e);
warningText.text = e.ToString();
}
}
else
{
Debug.Log("Failed");
}
}
test on windows error
USE_AUTH_EMULATOR not set.
UnityEngine.Debug:Log (object)
Firebase.Platform.FirebaseLogger:LogMessage (Firebase.Platform.PlatformLogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseLogger.cs:89)
Firebase.LogUtil:LogMessage (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:69)
Firebase.LogUtil:LogMessageFromCallback (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:77)
Firebase.Auth.FirebaseUserInternal:LinkWithCredentialInternalAsync (Firebase.Auth.Credential) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/auth/swig/Firebase.Auth_fixed.cs:3387)
Firebase.Auth.FirebaseUser/<LinkWithCredentialAsync>d__11:MoveNext () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/auth/src/FirebaseUser.cs:157)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Firebase.Auth.AuthResult>:Start<Firebase.Auth.FirebaseUser/<LinkWithCredentialAsync>d__11> (Firebase.Auth.FirebaseUser/<LinkWithCredentialAsync>d__11&)
Firebase.Auth.FirebaseUser:LinkWithCredentialAsync (Firebase.Auth.Credential)
GameSceneManager/<ConvertUserWithEmail>d__92:MoveNext () (at Assets/GameSceneManager.cs:1881)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<GameSceneManager/<ConvertUserWithEmail>d__92> (GameSceneManager/<ConvertUserWithEmail>d__92&)
GameSceneManager:ConvertUserWithEmail (string,string)
GameSceneManager:ChangeAnonymousToEmailLogin () (at Assets/GameSceneManager.cs:1669)
UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530)
Firebase.FirebaseException: This operation is not allowed. You must enable this service in the console.
at Firebase.Auth.FirebaseUser.LinkWithCredentialAsync (Firebase.Auth.Credential credential) [0x00037] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/auth/src/FirebaseUser.cs:157
at GameSceneManager.ConvertUserWithEmail (System.String email, System.String password) [0x00046] in D:\Life\Life\Assets\GameSceneManager.cs:1881
UnityEngine.Debug:Log (object)
GameSceneManager/<ConvertUserWithEmail>d__92:MoveNext () (at Assets/GameSceneManager.cs:1886)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Firebase.Auth.AuthResult>:SetException (System.Exception)
Firebase.Auth.FirebaseUser/<LinkWithCredentialAsync>d__11:MoveNext () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/auth/src/FirebaseUser.cs:159)
System.Threading.Tasks.TaskCompletionSource`1<Firebase.Auth.AuthResult>:SetException (System.Exception)
Firebase.Auth.Future_AuthResult/<>c__DisplayClass5_0:<GetTask>b__0 () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/auth/swig/Firebase.Auth_fixed.cs:1471)
Firebase.Auth.Future_AuthResult:SWIG_CompletionDispatcher (int) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/auth/swig/Firebase.Auth_fixed.cs:1561)
Firebase.AppUtil:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4812)
Firebase.Platform.FirebaseAppUtils:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseMonoBehaviour.cs:45)
test on device Exception
The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.