MaikuB / MaikuB/flutter_appauth
Some user cant login with google, redirect issue
Nobody has claimed this yet.
- Dominant language
- Objective-C
- Stars
- 308
- Forks
- 301
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 5
Description
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 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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the login() flow and its flutter_appauth 6.0.2 configuration, then compare the reported Sentry PlatformException with the Google redirect and loading behavior across the listed Android and iOS devices. Done means identifying a reproducible cause or affected configuration and confirming that the Google authentication flow completes for the affected users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart, flutter, ios
- Domain
- authentication, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100