Rank 2: Process
I have been having this issue for quite a while. This functionality was working fine on all flutter platforms, but then suddenly stopped working.
\n```","author":{"@type":"Person","name":"OppositeDragon"},"datePublished":"2024-01-16T21:43:59.907Z","url":"https://appwrite.io/threads/1196930357581336726#message-1196932894166360114"},{"@type":"Comment","text":"I would appreciate any help, on solving this. Thank you.","author":{"@type":"Person","name":"OppositeDragon"},"datePublished":"2024-01-16T21:45:38.658Z","url":"https://appwrite.io/threads/1196930357581336726#message-1196933308358082681"}]}}
Votes
0
Replies
7
Participants
Unknown
Messages
8
Rank 2: Process
I have been having this issue for quite a while. This functionality was working fine on all flutter platforms, but then suddenly stopped working.
Rank 2: Process
Rank 2: Process
on flutter android
Rank 2: Process
on flutter web
Rank 2: Process
Client client(ClientRef ref) { return Client().setEndpoint('https://cloud.appwrite.io/v1').setProject('linearprogrammingapp');}
Account account(AccountRef ref) { final client = ref.watch(clientProvider); return Account(client);}
Future<void> signInWithGoogle() async { final account = ref.read(accountProvider); final result = await account.createOAuth2Session( provider: 'google', success: _successCallback(), failure: _failureCallback(), ); debugPrint('google siginresult: $result'); }
String? _successCallback() { if (kIsWeb) { final Uri? location = href == null ? null : Uri.parse(href!); return '${location?.origin}/auth.html'; } switch (defaultTargetPlatform) { case TargetPlatform.android: return null; case TargetPlatform.fuchsia: return null; case TargetPlatform.iOS: return null; case TargetPlatform.macOS: return null; case TargetPlatform.linux || TargetPlatform.windows: return 'http://localhost:1001/auth/oauth2/success'; default: throw UnsupportedError('Unsupported platform'); } }
String? _failureCallback() { switch (defaultTargetPlatform) { default: return ''; } }Rank 2: Process
for androidManifest
<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-linearprogrammingapp" /> </intent-filter> </activity> Rank 2: Process
auth.html
<!DOCTYPE html><title>Authentication complete</title><p>Authentication is complete. If this does not happen automatically, please close the window.</p><script> window.opener.postMessage({ 'flutter-web-auth-2': window.location.href }, window.location.origin); window.close();</script>Rank 2: Process
I would appreciate any help, on solving this. Thank you.