Skip to content
Back

Flutter OAuth2 Google does not return to the mobile app

  • 0
  • Flutter
  • Auth
  • Cloud
Francisco
3 Jul, 2025, 16:08

When the flow starts, the browser opens, I select an account, and it keeps showing:

""" Page not found The page you're looking for doesn't exist. general_route_not_found """

Although the message remains displayed in the browser, the user appears in the Console.

The URL is: https://nyc.cloud.appwrite.io/console/auth/oauth2/success?project=the-recipes&domain=.nyc.cloud.appwrite.io&key=a_session_the-recipes&secret=

TypeScript
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application ...>
        <!-- ... -->
        
        <activity android:exported="true" android:name="com.linusu.flutter_web_auth_2.CallbackActivity" >
            <intent-filter android:label="flutter_web_auth_2">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="appwrite-callback-the-recipes" />
            </intent-filter>
        </activity>

      <!-- ... -->
    </application>
</manifest>
TypeScript
appwrite: 17.0.0
TypeScript
import "package:appwrite/enums.dart" as enums;

Future<void> signInWithGoogle() async {
  try {
    EasyLoading.show(status: "auth_controller.signing_in".tr);

    await _account.createOAuth2Session(
      provider: enums.OAuthProvider.google,
    );
    
    await _checkCurrentUser();
    
    EasyLoading.dismiss();
  } on AppwriteException catch (e) {
    EasyLoading.dismiss();
    print("Appwrite error: ${e.code} - ${e.message}");
    EasyLoading.showError("auth_controller.sign_in_error".tr);
  } catch (e) {
    EasyLoading.dismiss();
    print("General error: $e");
    EasyLoading.showError("auth_controller.sign_in_error".tr);
  }
}
TL;DR
Issue: The Flutter OAuth2 Google process does not redirect back to the mobile app and displays a 'Page not found' error. Solution: - Check the AndroidManifest.xml file for the correct configuration for CallbackActivity. - Ensure the pubspec.yml includes the correct version of the appwrite package. - Review the Dart code for any errors or misconfigurations in the signInWithGoogle function.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more