Search code examples
iosswiftsign-in-with-apple

How to remove the app from the Apple ID logins when uninstalling the app


I have an iOS Swift project which has Sign-in with Apple. When user tries to sign in with apple at first time, it will provide userId, first name, last name and email. But if we try to sign in with apple again from the same app, it will provide only userId. So What I'm doining is, at very first time I'll store the first name, last name and email in the preference(NSUserDefaults) with key userId. So when user tries second time, I will get the userId, with userId I will fetch data from preference and make the API call. This is fine. But what if I uninstall the app, and user try to reinstall the app and try to sign in with Apple, still I will get only userId. Since I uninstall the app, I don't have any preference with the key userId. So I cannot make the API Call. Is there any way to remove our app from the Apple ID logins when user uninstall the app. Please help me back.


Solution

  • You should store the user's details in your back-end server along with the user identifier that is provided in the sign-in response. For subsequent sign-ins you just get the identifier. You can use this to retrieve the user's details from your back end server. This also allows the user to sign in to your app on a different or additional device.

    Sign-in with Apple doesn't really make sense if you don't have a server to store the account details.