
I use the following code in flutter for the session creation for the login with apple:
try {
final response = await account.createOAuth2Session(
provider: 'apple',
success: "https://XX.com/auth/oauth2/success",
failure: "https://XX.com/auth/oauth2/failure",
);
print(response);
return response;
} on AppwriteException {
rethrow;
}
}````
To open the login page I use:
```ElevatedButton(
child: const Text('Login with Apple'),
onPressed: () async {
await AuthHelper().loginWithApple().then((value) {
prefs.setSessionId(value.$id);
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
}).onError((error, stackTrace) {
print(error);
});
},
),````
In the simulator I get the error seen in the screenshot. When I run the app on my iPhone with the cable connected the page opens fine, but when I click on login I get the error that the login is not possible ("registration not completed"). I host appwrite on digitalocean with a custom (sub-)domain.

This typically happens because of some mismatch between what was entered into Appwrite for the OAuth2 and Appwrite. This might help: https://dev.to/appwrite/apple-sign-in-with-appwrite-2576

Yeah I used this tutorial but it didn’t work.

Maybe you can tell me what domain and redirect uri I should add? The redirect uri should be the one from the appwrite Formular? And the domain just the domain from the appwrite instance. But it doesn’t work for me this way. Nothing comes back. Do I have to modify the success and failure URLs?

i've followed the tutorial before so it should work 🧐

Maybe you can tell me what domain and redirect uri I should add?
The domain should be your appwrite domain. the redirect url should be something like:
https://[DOMAIN]/v1/account/sessions/oauth2/callback/apple/[PROJECT ID]
Do I have to modify the success and failure URLs? These are unrelated to the error you're getting.
Make sure your Service ID in Apple matches the Bundle ID you put in Appwrite.

Yeah the problem was with the Service ID that has to match the Bundle ID in Appwrite. Thanks a lot!

[SOLVED] Flutter Login with Apple
Recommended threads
- Error response from daemon: driver faile...
on endpoint appwrite-traefik (00bbc10e5875d0c367d8975c6abc946a77b7ec201a64a825399add44fb34ebb4): failed to bind port 0.0.0.0:80/tcp: Error starting userland pro...
- "Memberships privacy" setting in 1.7.4
Hi everyone, I'm experiencing an issue with a clean self-hosted installation of Appwrite version 1.7.4. I previously used version 1.6.1, and if I remember corre...
- Issue with Appwrite Function Execution –...
Hi all, I'm encountering an issue when calling an Appwrite function from my Flutter app. **Environment:** ```Flutter SDK: 3.27.3 Appwrite Flutter SDK: 16.1.0```...
