Skip to content

[firebase_auth]: A headful operation is already in progress. Please wait for that to finish. #7300

@a1573595

Description

@a1573595

Description

This issue occurs in the Flutter version of Firebase Auth. According to SelaseKay's description, adjustments must be made in the Android SDK, so create a ticket here.

Reference: firebase/flutterfire#17659

If the user performs additional operations, such as navigating to other pages or closing the browser, the login function cannot be called again, is it possible to provide a function to terminate the previous login operation?

Environment

Android Studio version: Android Studio Narwhal Feature Drop | 2025.1.2 Patch 1
Flutter Firebase Core: 4.0.0
Flutter: 3.32.8

Steps to reproduce

  1. Click the Google Login button.
  2. Use Android overview to close Chrome App.
  3. Return to my App.
  4. Click the Google Login button again.

Expected results

Cancels the already running operation and creates a new one.

Actual results

Get exception: A headful operation is already in progress. Please wait for that to finish.

Screenshots or Video

2025-08-25.10.34.31.mov

Code sample

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';

class SampleScreen extends StatelessWidget {
  const SampleScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          child: const Text("Google Login"),
          onPressed: () async {
            final googleProvider = GoogleAuthProvider();

            await FirebaseAuth.instance
                .signInWithProvider(googleProvider)
                .then((value) {
                  debugPrint("test Google Login value: $value");
                  debugPrint("test Google Login profile: ${value.additionalUserInfo?.profile}");
                  debugPrint("test Google Login accessToken: ${value.credential?.accessToken}");
                })
                .onError((error, stack) {
                  debugPrint("test Google Login error $error");

                  ScaffoldMessenger.of(context).removeCurrentSnackBar();
                  ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(error.toString())));
                });
          },
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions