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

Some user cant login with google, redirect issue #574

Open
alibaltschun opened this issue Dec 3, 2024 · 0 comments
Open

Some user cant login with google, redirect issue #574

alibaltschun opened this issue Dec 3, 2024 · 0 comments

Comments

@alibaltschun
Copy link

alibaltschun commented Dec 3, 2024

Issue: Google Login Failing for Some Users on Flutter App
Description:
For the past month, many users have reported that they cannot log in using Google on the app. Some users are redirected to the Google login page, while others are stuck in a loading state after selecting their Gmail account. However, the issue is not reproducible on my device —I've tested on multiple devices, and Google login works without issues. Despite this, over 1000 users are unable to log in.

Error Details:
The error sent to Sentry is:


PlatformException
FlutterAppAuthUserCancelledException{platformErrorDetails: FlutterAppAuthPlatformErrorDetails(type: 0,
 code: 1,
 error: null,
 errorDescription: User cancelled flow,
 errorUri: null,
 domain null,
rootCauseDebugDescription: null,
 errorDebugDescription: AuthorizationException: {"type":0,"code":1,"errorDescription":"User cancelled flow"})}

Code:
Here’s the relevant code that handles the Google login flow:

dart
Copy code


Future<bool> login() async {
  final AuthorizationTokenRequest authorizationTokenRequest;

  try {
    authorizationTokenRequest = AuthorizationTokenRequest(
      GoogleClientID(),
      GoogleRedirectUrl(),
      issuer: GOOGLE_ISSUER,
      scopes: ['openid', 'email', 'profile'],
    );

    // Requesting the auth token and waiting for the response
    final AuthorizationTokenResponse? result =
        await _appAuth.authorizeAndExchangeCode(
      authorizationTokenRequest,
    );

    // Taking the obtained result and processing it
    return await _handleAuthResult(result);
  } on PlatformException catch (e) {
    Sentry.captureException(e, stackTrace: StackTrace.current);

    // Handle specific platform exceptions
    if (e.code == 'CANCELED') {
      toast('User canceled the login!');
    } else if (e.code == 'NETWORK_ERROR') {
      toast('No internet connection!');
    } else {
      toast('Platform Error: ${e.message}');
    }
    return false;
  } catch (e) {
    Sentry.captureException(e, stackTrace: StackTrace.current);
    toast('Failed with Error : $e');
    return false;
  }
}

Steps Taken to Resolve:
Device Testing: Tried on multiple devices including:
Samsung device
iPhone 8
iPhone 12
Android tablet
2 of my friend's Android phones
2 simulators The login works fine on all devices.

Error Capture: The error captured by Sentry is FlutterAppAuthUserCancelledException, indicating that the user canceled the login flow.
Package Update: I’ve updated all dependencies to the latest versions, but the problem persists.

Dependencies:
Here are the dependencies being used:


cupertino_icons: ^1.0.2
flutter_appauth: ^6.0.2
http: ^1.1.0
flutter_secure_storage: ^9.0.0
google_fonts: ^5.1.0
dots_indicator: ^3.0.0
flutter_riverpod: ^2.4.0
intl: ^0.18.1
flutter_lints: ^2.0.3
qr_flutter: ^4.1.0
jwt_decoder: ^2.0.1
get: ^4.6.6
flutter_easyloading: ^3.0.5
flutter_launcher_icons: ^0.13.1
flutter_dotenv: ^5.1.0
package_info: ^2.0.2
url_launcher: ^6.2.4
timetable_view: ^0.3.0
the_apple_sign_in: ^1.1.1
carousel_slider: ^5.0.0
firebase_core: ^2.24.2
firebase_messaging: ^14.7.10
flutter_local_notifications: ^17.0.0
sentry_flutter: ^8.10.1

Flutter version: 3.24.5 (Stable channel)

Problem:
Despite working on my devices and several other devices, over 1000 users are experiencing the issue. This suggests that the problem may be related to specific devices, OS versions, or configurations that I am unable to replicate.

Expected Behavior:
The Google login should work without errors, and users should be able to authenticate and access the app.

Actual Behavior:
Some users are redirected to the Google page or get stuck in a loading loop, leading to a cancellation of the login process. Sentry logs show that the users are cancelling the login flow.

Request for Help:
I’m unable to reproduce the issue, and I need assistance in diagnosing why this issue is occurring for some users but not on my devices. Any insights or suggestions to help resolve this would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant