supabase / supabase-flutter

Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
https://supabase.com/
MIT License
708 stars 167 forks source link

Supabase Google sign out does not sign out user #1015

Closed pidanou closed 1 month ago

pidanou commented 1 month ago

Describe the bug I am using flutter_auth_ui (which apparently uses supabase-flutter), and I added Google social auth. Using Supabase.instance.client.auth.signOut() does signOut the user but when the user logs in again, the app does not ask to choose the desired Google account.

I suspected that Supabase.instance.client.auth.signOut() does not sign out the user from Google.

So I added _googleSignIn.signOut(); where _googleSignin is an instance of GoogleSignIn from google_sign_in package and with that, when the user tries to login again, the app asks for the desired account to be used.

Here is the full code snippet:

This does not work:

onTap: () async {
                  await Supabase.instance.client.auth.signOut().then((value) {
                    GoRouter.of(context).go('/login');
                  });
                },

This works:

onTap: () async {
                  await Supabase.instance.client.auth.signOut().then((value) {
                    _googleSignIn.signOut();
                    GoRouter.of(context).go('/login');
                  });
                },

To Reproduce Steps to reproduce the behavior:

  1. See code snippet

Expected behavior When using signOut method, the user should be disconnected and when he tries to login again, he should be able to select the desired account. And without using _googleSignIn.signOut();

Screenshots If applicable, add screenshots to help explain your problem.

Version (please complete the following information): On Linux/macOS

├── supabase_auth_ui 0.5.0
│   └── supabase_flutter...
└── supabase_flutter 2.5.11
    ├── supabase 2.2.7
    │   ├── functions_client 2.3.1
    │   ├── gotrue 2.8.3
    │   ├── postgrest 2.1.3
    │   ├── realtime_client 2.2.0
    │   ├── storage_client 2.0.2
dshukertjr commented 1 month ago

I think for the auth UI, it does make sense to automate things, but for the supabase-flutter SDK, it makes more sense to do less automation so that the developer has full control over what happens. If the developer wants to sign out of Google when Supabase auth signs out, they can.