firebase-unity-sdk icon indicating copy to clipboard operation
firebase-unity-sdk copied to clipboard

[Bug] How to fix "The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console" I can't convert an anonymous account to a permanent account

Open 11101100 opened this issue 2 years ago • 2 comments

[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 image

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/[email protected]/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)

image

image

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.

11101100 avatar Nov 06 '23 16:11 11101100

Hi @11101100,

There is a known issue caused by the the Email Enumeration protection feature that is enabled by default on new projects, and a workaround for this is to disable this feature.

That said, I'll be marking this as a bug for now. You may refer to this thread for updates.

paulinon avatar Nov 08 '23 13:11 paulinon

I was also getting this error the given sign-in provider is disabled for this firebase project and I tried all possible methods but nothing works anything for me. Then I downgrade androidx.core:core-ktx:1.12.0 to androidx.core:core-ktx:1.9.0 and luckily error resolved.

ShaheenDevelopers avatar Mar 16 '24 14:03 ShaheenDevelopers

Hey folks, so for context, Email Enumeration protection feature removes proper error messages, this is intended so that attackers won't be able to identify what emails are in use. This vague error message This operation is not allowed. You must enable this service in the console. is the result of using Email Enumeration protection. Now, if you're in the development phase of your app, you may simply disable this feature, so you can identify what's wrong with your setup.

Your code snippet doesn't seem to have any issues. I'm guessing the likely error is that the email is already in used. If you have any questions regarding how to correctly convert anonymous accounts to permanent accounts. You may go through our documentations. If you'd like code references for LinkWithCredentialAsync you may use our Quickstart Unity, the specific method is here.

That said, testing LinkWithCredentialAsync is working correctly as intended with version 11.9.0. I'll go ahead and close this thread.

argzdev avatar Jun 25 '24 14:06 argzdev