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]Firebase.FirebaseException: A headful operation is already in progress. Please wait for that to finish #1267

Open
liuchong-94 opened this issue May 8, 2022 · 9 comments

Comments

@liuchong-94
Copy link

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.2.7f1
  • Firebase Unity SDK version: 8.7.0
  • Source you installed the SDK: unitypackage (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: Auth (Auth, Database, etc.)
  • Other Firebase Components in use: _____ (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)

[REQUIRED] Please describe the issue here:

I use this example to log in apple id on Android.

Firebase.Auth.FederatedOAuthProviderData providerData =new Firebase.Auth.FederatedOAuthProviderData();
providerData.ProviderId = "apple.com";
providerData.Scopes = new List();
providerData.Scopes.Add("email");
providerData.Scopes.Add("name");
Firebase.Auth.FederatedOAuthProvider provider =
new Firebase.Auth.FederatedOAuthProvider();
provider.SetProviderData(providerData);
auth.SignInWithProviderAsync(provider).ContinueOnMainThread(task => {
if (task.IsCanceled) {
Debug.LogError("SignInWithProviderAsync was canceled.");
return;
}
if (task.IsFaulted) {
Debug.LogError("SignInWithProviderAsync encountered an error: "
task.Exception);
return;
}

Firebase.Auth.SignInResult signInResult = task.Result;
Firebase.Auth.FirebaseUser user = signInResult.User;
Debug.LogFormat("User signed in successfully: {0} ({1})",
    user.DisplayName, user.UserId);

});

Everything works fine on Android. But when I pull up the authorization page and click the home button, I go back to my game from the desktop.Then when I call SignInWithProviderAsync again in the same way, I get an error :

SignInWithProviderAsync encountered an error: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: A headful operation is already in progress. Please wait for that to finish.
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> Firebase.FirebaseException: A headful operation is already in progress. Please wait for that to finish.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: A headful operation is already in progress. Please wait for that to finish.<---
<---
UnityEngine.Logger:Log(LogType, Object)
MobileLoginService:b__13_0(Task1) System.Action1:Invoke(T)
Firebase.Extensions.c__AnonStorey9:<>m__0()
System.Func1:Invoke() Firebase.<RunAsync>c__AnonStorey11:<>m__0()
System.Action:Invoke()

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes.
What's the issue repro rate? (eg 100%, 1/5 etc) 100%

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

  1. Download and configure this github project to make it run

  2. Modify the SignInWithProvider function:
    protected void SignInWithProvider(string providerId) {
    var providerData = new Firebase.Auth.FederatedOAuthProviderData();
    providerData.ProviderId = "apple.com";
    providerData.Scopes = new List() { "name", "email" };

       var provider = new Firebase.Auth.FederatedOAuthProvider();
       provider.SetProviderData(providerData);
       
       auth.SignInWithProviderAsync(provider).ContinueWithOnMainThread(signin_task => {
       if (LogTaskCompletion(signin_task, "SignInWithProvider")) {
         DebugLog("SignInWithProviderTask Completed:"   signin_task.IsCompleted);
       }
    
       if(signin_task.Exception != null) {
         DebugLog("SignInWithProviderTask - Exception: "   signin_task.Exception.Message);
         return;
       }
    
       DisplaySignInResult(signin_task.Result, 1);
    

    });
    }

  3. Click SignInWith | Miscrosoft, open the browser and click the home button to return to the Android desktop, click app to return to the application, and click SignInWith | Miscrosoft again.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:

// TODO(you): code here to reproduce the problem

Screenshot_20220508-173751_Chess Minis

@paulinon paulinon removed the new New issue. label May 10, 2022
@paulinon
Copy link
Contributor

Hi @liuchong-94,

Thanks for reporting this. While I try to replicate this issue, could you confirm if a similar behavior persists using the latest version of the SDK (8.10.1)?

@paulinon paulinon added the needs-info Need information for the developer label May 10, 2022
@liuchong-94
Copy link
Author

Hi @liuchong-94,

Thanks for reporting this. While I try to replicate this issue, could you confirm if a similar behavior persists using the latest version of the SDK (8.10.1)?

Thank you for your reply. I tested 8.10.1 and the same error occurred

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 11, 2022
@paulinon
Copy link
Contributor

Hi @liuchong-94,

I haven't been able to replicate your issue yet because I'm facing an error when using the code you provided in Step 2. Could you confirm if the exact code returned no error on your end? It would be helpful if you provide a minimal, reproducible example so that it can be used as a baseline for troubleshooting.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels May 11, 2022
@liuchong-94
Copy link
Author

Hi, @paulinon
you can download the sample project here.
https://drive.google.com/file/d/1girOChQyZrIXuqRR9MEDXcxI0WQuKhTS/view?usp=sharing

There are two ways to use it.

  1. You can configure google-services.json, GoogldSerivce-Info-plist etc and then build it. (I can't provide mine because it will be used in our official project)
  2. Just replace UIHandler.cs in your project, I only modified the SignInWithProvider function.

@liuchong-94 liuchong-94 reopened this May 13, 2022
@paulinon paulinon added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 13, 2022
@paulinon
Copy link
Contributor

Hi @liuchong-94,

It appears that I don't have access to your sample project. I recommend that you upload this to a GitHub repository then add me as a collaborator.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels May 13, 2022
@liuchong-94
Copy link
Author

Hi @paulinon.
I upload project to this repository: https://github.com/liuchong-94/firebaseAuthTest

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 14, 2022
@paulinon
Copy link
Contributor

paulinon commented May 16, 2022

Thanks for this, @liuchong-94. I was able to replicate the behavior, and I can see how this is a bug. If a user accidentally tapped home while they're in the middle of signing up with the Apple window, they'll return to their app with the Apple window gone, and the app still thinks that the authentication process is ongoing even though the user can't proceed on their end.

That being said, I've relayed my findings to the team. You may refer to this thread for updates. I'll be marking this as a bug for now

@paulinon paulinon added type: bug and removed type: question needs-attention Need Googler's attention labels May 16, 2022
@yangnnytao
Copy link

Thanks for this, @liuchong-94. I was able to replicate the behavior, and I can see how this is a bug. If a user accidentally tapped home while they're in the middle of signing up with the Apple window, they'll return to their app with the Apple window gone, and the app still thinks that the authentication process is ongoing even though the user can't proceed on their end.

That being said, I've relayed my findings to the team. You may refer to this thread for updates. I'll be marking this as a bug for now

I encountered this problem and found the real trigger process,
The details are:

When calling the Web login page, FireBase should open an activity,
After the FireBase activity is enabled and before the web page is opened, if you go back,
This will cause FireBase's activities to fail to listen to the Web's exit monitoring,
As a result, FireBase's logic can't handle the listening logic after the Web page exits, and it is always logged in

@yangnnytao
Copy link

I guess this problem can be solved as long as the rollback function is prohibited in the middle process,
But the process belongs to Firebase, and we can't modify 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

4 participants