Back

[SOLVED] Appwrite Cloud: Google OAuth2 works in iOS emulator, but not in Physical android

  • 1
  • Flutter
  • Accounts
D5
2 Oct, 2023, 07:07

Did you added the needed lines into the android manifest file?

TL;DR
Title: [SOLVED] Google OAuth2 not working on physical Android device Messages: User experienced an issue with Google OAuth2 not working on a physical Android device, but it worked on an iOS emulator. Another user identified the problem as a wrong activity name and incorrect Android label. They provided the correct code snippet to update the Android manifest file. The user confirmed that the solution worked.
Tim Se
2 Oct, 2023, 07:07

yes. but when account.get() I get 401

D5
2 Oct, 2023, 07:08

And set project ID there?

Tim Se
2 Oct, 2023, 07:08

yes:

TypeScript
<activity android:name="io.appwrite.views.CallbackActivity" android:exported="true">
            <intent-filter android:label="android_web_auth">
                <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-xxx" />
            </intent-filter>
        </activity>
Tim Se
2 Oct, 2023, 07:08

xxx is my projec tid

D5
2 Oct, 2023, 07:10

Do you have internet permission flag added too?

Tim Se
2 Oct, 2023, 07:12

yes

Tim Se
2 Oct, 2023, 07:13
<uses-permission android:name="android.permission.INTERNET"/>
D5
2 Oct, 2023, 07:15

Interesting

D5
2 Oct, 2023, 07:16

Then there should be any issue with your dart code πŸ€”

Maniac_Fighter
2 Oct, 2023, 07:16

your activity name seems to be incorrect

Maniac_Fighter
2 Oct, 2023, 07:17
TypeScript
 <activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true"> --> This should be exact
      <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-[PROJECT_ID]" /> --> Your ProjectId
      </intent-filter>
    </activity>
Tim Se
2 Oct, 2023, 07:17

owh

Tim Se
2 Oct, 2023, 07:17

it seems like the android label is wrong as well

Maniac_Fighter
2 Oct, 2023, 07:17

yep that too

D5
2 Oct, 2023, 07:18

Just realised πŸ‘€ that's the problem then

Maniac_Fighter
2 Oct, 2023, 07:18

so what's happening is its trying to detect another activity of that name but since there isn't any custom code available, it doesn't do anything

Tim Se
2 Oct, 2023, 07:18

ahh damnit πŸ˜†

Tim Se
2 Oct, 2023, 07:18

Thank you!

Tim Se
2 Oct, 2023, 07:18

Let me try it out

D5
2 Oct, 2023, 07:19

Okay, confirm with us that it works

Tim Se
2 Oct, 2023, 07:19

Thanks @Steven @Maniac_Fighter @D5

Tim Se
2 Oct, 2023, 07:20

Yeap it works! You guys are amazing

D5
2 Oct, 2023, 07:22

Great! Glad to hear that. Special thanks to @Maniac_Fighter for finding the issue! :appwritepeepo:

D5
2 Oct, 2023, 07:22

[SOLVED] Appwrite Cloud: Google OAuth2 works in iOS emulator, but not in Physical android

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