Back

[Solved] Getting Missing Redirect on Google OAuth login

  • 0
  • Flutter
Asutosh
14 Aug, 2023, 14:22

so to capture the Appwrite OAuth callback url you need to add a seperate activity tag

TL;DR
The user is experiencing an issue with missing redirects on Google OAuth login. They are using the createOAuth2Session function but are being given the option to pick rather than being auto-directed. They suspect that it might be due to multiple activities. The solution is to add a separate activity tag in the Android manifest file to capture the Appwrite OAuth callback URL. After making this change, the issue is resolved.
Asutosh
14 Aug, 2023, 14:25
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-[PROJECT_ID]" />
      </intent-filter>
    </activity>

add this as a separate activity along side the existing activity tags thats there when you create the project and it should work

DevIos
14 Aug, 2023, 14:30

it's giving me option to pick rather than autodirect could it be because of multiple activity?

Asutosh
14 Aug, 2023, 14:33

yup I guess

Asutosh
14 Aug, 2023, 14:34

havn't seen this before

Asutosh
14 Aug, 2023, 14:35

Let me know if you are able to oauth

DevIos
14 Aug, 2023, 14:35

yup seems so , anyway i have removed to other one as it was also for redirect after auth0 for another service , as i will be using appwrite the one you gave is enough , thanks!

DevIos
14 Aug, 2023, 14:39

i mean i am being redirect now to app itself but its null

idk if i need to wait or make callback

this is current code

TypeScript
  Future<void> handelFacebookSigin() async {
   final user = await account.createOAuth2Session(provider: 'facebook');
   print(user);
  }

when the redirect happens and logs is : I/flutter ( 9989): null

DevIos
14 Aug, 2023, 14:40

could it be beacuse the user aleardy exist , as we are using createauth?

Asutosh
14 Aug, 2023, 14:53

Check if the user is being added to your appwrite project

Asutosh
14 Aug, 2023, 14:55

To answer this once your app is authenticated with oauth provide you can access the user data using getAccount method

DevIos
14 Aug, 2023, 14:55

i deleted it from appwrite project

i clicked facebook login > it said i had previous logged and click continued > redirect > logs null > but looking at appwrite project the user is created and verfied

XaFigg
14 Aug, 2023, 14:56

The createOAuth2Session function does not return anything

DevIos
14 Aug, 2023, 14:57

ah

XaFigg
14 Aug, 2023, 14:57

To retrieve the user you have to use account.get() after use the createOAuth2Session

Asutosh
14 Aug, 2023, 14:57

That means the user is being added. You can access the user details with getAccount method

DevIos
14 Aug, 2023, 15:03

ah okay! i thought it would return with session id and use that to get data , lemme try!

DevIos
14 Aug, 2023, 15:03

and yup it's working correctly, thanks again!

DevIos
14 Aug, 2023, 15:04

should i close the post or just rename it to solved

Asutosh
14 Aug, 2023, 15:05

Rename solved

DevIos
14 Aug, 2023, 15:05

Alight!

DevIos
14 Aug, 2023, 15:06

[Solved] Getting Missing Redirect on Google OAuth login

ZiaChoudhary
30 Sep, 2023, 19:05

I am getting the same issue mentioned https://discord.com/channels/564160730845151244/1140629660170981416/1140653790253559829 i.e after calling createOAuth2Session its giving me option to pick rather than autodirect could it be because of multiple activity? Is there any workaround?

Drake
30 Sep, 2023, 19:09

Please create a new post instead of posting in an old thread

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