Skip to content

[auth]: web-context-already-presented error on Android due to android:taskAffinity="" #17831

@passsy

Description

@passsy

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Android

Description

This is a followup to the closed/locked issue #13297 which I ran into. The chrome custom tab disappears when I switch apps (e.g. to open my password manager) and opening the login again returns the error web-context-already-presented.

copy_1864E306-A54C-4C93-9C1D-9D63FF9AA559.MOV

The solution to that is mentioned here: MaikuB/flutter_appauth#503 (comment)

Remove android:taskAffinity="" from the AndroidManifest.xml


The firebase_auth sdk should detect this, and show a waning

Reproducing the issue

Reproducible in the firebase_auth example application https://github.com/firebase/flutterfire/tree/main/packages/firebase_auth/firebase_auth/example

Using signInWithProvider.

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("Login"),
          onPressed: () async {
            final provider = TwitterAuthProvider(); // or any other that opens a webview
            await FirebaseAuth.instance.signInWithProvider(provider);
          },
        ),
      ),
    );
  }
}

Firebase Core version

3.13.0

Flutter Version

3.24.5

Relevant Log Output

Flutter dependencies

No response

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.platform: androidIssues / PRs which are specifically for Android.plugin: authtype: documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions