I have been having this issue for quite a while. This functionality was working fine on all flutter platforms, but then suddenly stopped working.
on flutter android
on flutter web
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 '';
}
}
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>
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>
I would appreciate any help, on solving this. Thank you.
Recommended threads
- proccessing problems
A database schema operation is stuck in my Frankfurt project. In the matryq database, the workspaceId attribute of the coaching_activity_entries collection rema...
- User column is processing
I am still encountering the processing tag after creating a column in my database. and its not a network or refresh issue, i have refreshed over and over, shutd...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...