Skip to content
Back

Cannot use Google Oauth in my Project

  • 0
  • Android
  • Auth
retr12
21 Sep, 2025, 14:11

I tried to use Appwrite Google Oauth Provider in my app but had some troubles. I receives this error no matter what: error or success: 2025-09-21 18:50:33.845 31994-32115 System.err com.quizop.cookme W java.lang.IllegalStateException: User cancelled login 2025-09-21 18:50:33.845 31994-32115 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion.cleanUp(WebAuthComponent.kt:94) 2025-09-21 18:50:33.846 31994-32115 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion.authenticate(WebAuthComponent.kt:70) 2025-09-21 18:50:33.846 31994-32115 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion$authenticate$1.invokeSuspend(Unknown Source:18) 2025-09-21 18:50:33.846 31994-32115 System.err com.quizop.cookme W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)

TL;DR
Developers are facing a problem using Google OAuth in their project. The auth window closes abruptly with the error "User cancelled login." One potential solution found in the code provided involves setting the correct paths and schemes in the Android manifest file to handle oauth2redirects properly.
retr12
21 Sep, 2025, 14:11
TypeScript
                                LoginActivity.this,
                                OAuthProvider.GOOGLE,
                                "https://cookmee.net/login-google-success", // success (optional)
                                "https://cookmee.net/login-google-fail",
                                new CoroutineCallback<>((result2, error2) -> {
                                    if (error2 != null) {
                                        runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                findViewById(R.id.loginLoadingPanel).setVisibility(View.GONE);
                                            }
                                        });
                                        catchErrorFunc(error2);
                                        return;
                                    }

                                    try {
                                        account.get(
                                                new CoroutineCallback<>((result4, error4) -> {
                                                    if (error4 != null) {
                                                        catchErrorFunc(error4);
                                                        return;
                                                    }

                                                    User<Map<String, Object>> currentUser = result4;

                                                    Log.e("CURRENT USER", currentUser.toString());
                                                }));
                                    } catch (AppwriteException e) {
                                        catchErrorFunc(e);
                                    }

                                    Log.d("Appwrite", result2.toString());
                                }));```
retr12
21 Sep, 2025, 14:12
TypeScript
            android:name=".LoginActivity"
            android:exported="true"
            android:launchMode="singleTop">
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="https"/>
                <data android:host="cookmee.net"/>
                <data android:pathPrefix="/login-google-success"/>
                <data android:scheme="https"/>
                <data android:host="cookmee.net"/>
                <data android:pathPrefix="/login-google-fail"/>
            </intent-filter>
            <intent-filter android:label="oauth2redirect">
                <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"/>
            </intent-filter>
        </activity>```
retr12
21 Sep, 2025, 14:13

Auth window closes and nothing happened and I received error User cancelled login 2025-09-21 19:12:31.996 7021-7263 System.err com.quizop.cookme W java.lang.IllegalStateException: User cancelled login 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion.cleanUp(WebAuthComponent.kt:94) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion.authenticate(WebAuthComponent.kt:70) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at io.appwrite.WebAuthComponent$Companion$authenticate$1.invokeSuspend(Unknown Source:18) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) 2025-09-21 19:12:31.997 7021-7263 System.err com.quizop.cookme W at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

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