I am trying to add Sign in with Apple to my app. I added the AppID, Service ID, etc in the developer's portal. I also configured the Appwrite to enable the Sign in with Apple service. I used the Service ID (Not the bundle ID) in the AppWrite's Apple OAuth. I write the following code in the SignInWithAppleButton's onCompletion closure.
do {
_ = try await account.createOAuth2Session(provider: .apple, scopes: ["email", "fullName"])
print("Successfully signed in with Apple!")
} catch {
print("Failed to create session: \(error.localizedDescription)")
}
The app ends up opening up the sign in sheet in the app -> Pop to website -> Sheet appears again -> go back to the app. Not only this weird problem, here are some more:
- I can trap the callback with .onOpenURL in the SwiftUI view. But it is kind of weird and not sure whether the user has been logged in successfully or not. How to do that properly?
- I can see the Apple ID is being added to the AppWrite Auth's user list. but it only able to track the email not the name. Would I be able to do that?
I tried to search the internet tutorial but most of them are for SignInWithApple + Web App. I can't find any proper tutorial for native SwiftUI app. If any info you have may help, please feel free to let me know.
After sign in a session is created. so you can use account.get() to get current session and userID
Its weird how this is configured.
- You are probably using native sign-in [the first oauth modal]
- On completion, you are triggering another OAuth that takes you to Safari.
You don't need #1 here.
See - https://appwrite.io/docs/products/auth/oauth2
Select Apple in the language selector.
Do you mean I should not use the native siginwithapplebutton?
I tried to switch to NOT use the native SignInWithApple button. It just switch to the Safari every single time.
Have you find the solution? I’m with the same problem and can’t be redirected to my app once the user is signed in, it just remains in the same state
Recommended threads
- Quota not resetting
hi, im using appwrite's free tier plani hit my read limts last month and the billing cycle said it would reset on june 4th but that is today, the billing cycle ...
- Realtime Error Invalid query: Syntax err...
I was test driving Self-Hosted Appwrite for my use with Swift IOS apps as a backend while back and after successful trials, I started to move to incorporate int...
- TSL Certificate Issues
Hi Appwrite Discord Community, I got a problem with my Self-Hosted instance. I only want, that I can use my programm with the Appwrite Backend without .selfSig...