I'm facing an issue with the Google OAuth2 login flow on my Flutter Android app using the Appwrite SDK. After a successful sign-in with Google, the browser enters a redirect loop instead of returning to my app. The login flow previously worked as expected, but has recently started failing.
For use with requests from a web server
URIs 1
https://fra.cloud.appwrite.io/v1/account/sessions/oauth2/callback/google/[PROJECT_ID]
URIs 2
https://cloud.appwrite.io/v1/account/sessions/oauth2/callback/google
URIs 3
https://cloud.appwrite.io/v1/account/sessions/oauth2/callback/google/[PROJECT_ID]
and in my code
Future<void> signInWithOAuth(OAuthProvider provider) async {
try {
print("š Starting OAuth sign-in with provider: $provider");
// ā
Check existing session
try {
final currentUser = await _account.get();
print("ā ļø User already logged in. Logging out first...");
await signOut();
} catch (_) {
// no active session, safe to continue
}
await _account.createOAuth2Session(provider: provider);
print("ā
OAuth session created successfully. Checking auth status...");
await checkAuthStatus();
} on AppwriteException catch (e) {
print("ā AppwriteException during OAuth: ${e.message}, code: ${e.code}");
if (e.response != null) {
print("š” Full error response: ${e.response}");
}
Get.snackbar('Error', e.message ?? 'OAuth sign-in failed');
} catch (e) {
print("ā ļø Unexpected error during OAuth: $e");
Get.snackbar('Error', 'An unexpected error occurred.');
}
}
Now when i press login button in my app it opens a browser with google login page. then i select my account and it loads and i see the appwrite loading page and then back to google login page inside the browser. meanwhile my terminal
OAuth session created successfully. Checking auth status... and if i manually close the browser i'm logged in.
Recommended threads
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support š I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...
- Bug: TOTP MFA verification always fails ...
*Bug: TOTP MFA verify always returns `user_invalid_token` (Cloud 1.8.1, Frankfurt)** Project ID: `68dd48440003e537d849` SDK: `appwrite@18.2.0` (also tested wit...
- User Filter/Sorting/Analytics
Currently the dashboard for users is very limited. I would like to have an option to sort by column and also to filter by column, to for example find users that...