flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_auth]: `signOut` cannot sign out the Twitter Auth Provider

Open AlexV525 opened this issue 7 months ago • 7 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Android, iOS

Description

Calling FirebaseAuth.signOut cannot sign out of Twitter from the opening web tab; it still automatically redirects to the previous logged-in Twitter account.

Reproducing the issue

  1. Use TwitterAuthProvider to sign in.
  2. Call FirebaseAuth.instance.signOut.
  3. Reauth with TwitterAuthProvider.

Firebase Core version

3.13.0

Flutter Version

3.27.4

Relevant Log Output

No helpful information.

Flutter dependencies

pubspec.lock
  firebase_auth:
    version: "5.5.2"
  firebase_auth_platform_interface:
    version: "7.6.2"
  firebase_auth_web:
    version: "5.14.2"
  firebase_core:
    version: "3.13.0"
  firebase_core_platform_interface:
    version: "5.4.0"
  firebase_core_web:
    version: "2.22.0"

Additional context and comments

No response

AlexV525 avatar May 07 '25 03:05 AlexV525

Hey there, i have been unable to reproduce using our example application This leads me to suspect it might be an implementation issue on your end. I would like to ask you to please check out the example application and compare implementations. If it still does not work I am happy to take a look at your repo if you are able to share it. Perhaps you might not be awaiting the signout properly?

MichaelVerdon avatar May 07 '25 11:05 MichaelVerdon

@MichaelVerdon : Thanks for your reply. The example you are pointing to does not involve Twitter sign-in. Could you elaborate on your changes to make the example work with that provider?

Here are my code snippets with the package:

_$ equals FirebaseAuth.instance.

  static Future<UserCredential> signInWithX() async {
    final provider = TwitterAuthProvider();
    provider.setCustomParameters({
      'scopes': 'users.read offline.access',
      'lang': 'en',
    });
    final credential = await _$.signInWithProvider(provider);
    return credential;
  }

  static Future<void> logout() async {
    await _$.signOut();
  }

AlexV525 avatar May 07 '25 13:05 AlexV525

@MichaelVerdon : Thanks for your reply. The example you are pointing to does not involve Twitter sign-in. Could you elaborate on your changes to make the example work with that provider?

Hi there, the example does have Twitter sign in, here is the exact link to it. Hope this helps 😄 https://github.com/firebase/flutterfire/blob/b2e02a4e9867a76b8a82576ad079234d9f1be1fe/packages/firebase_auth/firebase_auth/example/lib/auth.dart#L586

MichaelVerdon avatar May 08 '25 09:05 MichaelVerdon

Hi there, the example does have Twitter sign in, here is the exact link to it. Hope this helps 😄

@MichaelVerdon : Thanks for pointing it out.

I've tried the example with "Sign in with Twitter" and it reuses my authorization in other apps as it opens a system web tab and redirects directly. Calling signOut also reproduces the same behavior here.

https://github.com/user-attachments/assets/3fa4efcf-ec7e-4c98-b20d-eb32643022eb

AlexV525 avatar May 09 '25 06:05 AlexV525

Hi there, thanks for the video I can confirm I am able to reproduce and must have misunderstood you before and I believe this is expected behaviour. Whilst sign out makes the firebase session end I don't think it makes the twitter session end. And I do not think this is something we can do on our side. I think the only way around it is to make a flow where you sign out of twitter in browser at the same time as signing out of auth together.

MichaelVerdon avatar May 09 '25 10:05 MichaelVerdon

It seems that the native library contains the related ability. https://github.com/firebase/FirebaseUI-Android/pull/645

AlexV525 avatar May 09 '25 13:05 AlexV525

It seems that the native library contains the related ability. firebase/FirebaseUI-Android#645

I see, might be worth opening a ticket there and seeing what they say.

MichaelVerdon avatar May 09 '25 15:05 MichaelVerdon