Skip to content
Back

Google Oauth2 not working

  • 0
  • Self Hosted
  • Flutter
Asdshadow
20 Feb, 2024, 03:06

Good day I have set up google oauth2 but for some reason it sticks on account.google.com

my createoath2 function

TypeScript
  singInWithProvider({required String provider}) async {
    try {
      await account.createOAuth2Session(
        provider: provider,
      );
      await Future.delayed(const Duration(microseconds: 500));
      await loadUser();
      return null;
    } catch (e) {
      debugPrint("$e");
    } finally {
      notifyListeners();
    }
  }

I also added the clientId and app secret in appwrite and this is my android manifest

TypeScript
<activity
            android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
            android:exported="true">
            <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-[I put my project id here]" />
            </intent-filter>
        </activity>

for my first login it asked me for my user account but it never created a user or a session. and it has not worked after. it hangs accounts.google.com

TL;DR
Google OAuth2 setup seems to be stuck on accounts.google.com. The provided function appears to be missing crucial steps for user creation and session handling. Ensure proper configuration of client ID, app secret, and Android manifest. Additionally, consider debugging for any errors.
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