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
- how can i make a relationship between a ...
i want to relate the $id from users auth table in appwrite with other column in my table user_profile. because is the same user... how can i have exactly the s...
- `type 'Null' is not a subtype of type 'b...
When creating a new file using Appwrite Flutter SDK, the file is successfully created on the server, but the client throws the following exception: ``` type ...
- Need help to create a wrapper which let ...
Iโm looking for help setting up Appwrite properly on a VPS so I can build a self-hosting wrapper around it. The goal is to provide a Linux executable that allow...