Hello Appwriter,
i'm creating an OAuth Login with Apple, i have configure everything on my Apple Developer Account and in my Appwrite Console, When i Login with Apple, the user Full name and Email is Created in the Appwrite Cloud Cosole (Auth)
I dont know what's wrong in my code, i keep getting this error response:
GOING TO ROUTE /App
flutter: #0 ClientIO.webAuth.<anonymous closure> (package:appwrite/src/client_io.dart:371:9)
flutter: <asynchronous suspension>
flutter: #1 AppwriteService.loginWithOAuth (package:prayerbuddynewlook/services/appwrite_service.dart:88:7)
flutter: <asynchronous suspension>
flutter: #2 AuthController.loginWithOAuth (package:prayerbuddynewlook/controllers/auth_controller.dart:41:7)
flutter: <asynchronous suspension>```
**here is my Appwrite Services:**
```Future<void> loginWithOAuth(String provider) async {
try {
final redirectUri = 'https://prayerbuddyapp.joons-me.com';
await account.createOAuth2Session(
provider: _mapProvider(provider), // 'facebook', 'google', 'apple'
success: '$redirectUri/loginSuccess',
failure: '$redirectUri/loginFail',
);
_currentUserId = null;
} catch (e, s) {
debugPrint('OAuth login error: $e\n$s');
throw Exception('OAuth login failed');
}
}
OAuthProvider _mapProvider(String name) {
switch (name.toLowerCase()) {
case 'google':
return OAuthProvider.google;
case 'facebook':
return OAuthProvider.facebook;
case 'apple':
return OAuthProvider.apple;
// add more if you need them
default:
throw Exception('Unknown provider $name');
}```
Here is my Controller
isLoading.value = true;
try {
await _appwrite.loginWithOAuth(provider);
currentUserId.value = await _appwrite.getCurrentUserId();
print('currentUserId ${currentUserId.value}');
print("LoginSuccess Controller");
Get.offAll(() => const App(login: true));
} catch (e) {
Get.snackbar('Error', e.toString());
} finally {
isLoading.value = false;
}
}```
Here is my DeepLink
Future<void> initDeepLinks() async {
// print('Deep-Initial');
// Check initial link if app was in cold state (terminated)
final appLink = await _appLinks.getInitialLink();
if (appLink != null) {
var uri = Uri.parse(appLink.toString());
var pathName = uri.pathSegments[0];
if (pathName == 'loginSuccess') {
print("LoginSuccess Deeplink");
Get.to(() => const App(login: true));
} else if (pathName == 'loginFail') {
print("LoginFail Deeplink");
Get.to(() => const Login());
} else if (pathName == 'series') {
Get.to(() => const App(login: true));
} else if (pathName == 'messageSeries') {
var seriesId = uri.queryParameters["seriesId"];
var vidId = uri.queryParameters["vidId"];
// Get.to(() => WatchVideoDeepLink(seriesId: seriesId.toString(), vidId: vidId.toString()));
}
//Get.to(() => const Login());
}
}
each and everytime LoginSuccess Deeplink is printed out, but the error output above is still be outputted
Recommended threads
- Problem with the new Email policies
when user set those thing from cloud panel and when they open that page again or reload that time it forget what we have checked and it set default to false on ...
- Deleted my account, trying to signup aga...
https://cloud.appwrite.io/console/login?error=%7B%22message%22%3A%22This+email+address+must+already+be+in+its+canonical+form.+Please+remove+aliases%2C+tags%2C+o...
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...