Adopting Sign In With Apple

Create a sign in button, verify data and handle user authorization changes

Jun 17 · 3 min read
Photo by Michał Kubalczyk on Unsplash

With Apple’s recent announcement at WWDC of Sign In With Apple, you as a developer can give your users a whole new option to create an account and sign into your application. Let’s dive in and take a look at how to build Sign In With Apple into your app.

Enable Sign In With Apple to Your App Bundle ID

Log in to your developer account. Under your app identifier setting -> Capabilities, check Sign in with Apple.

check Sign in with Apple

Enable Sign In With Apple From Xcode

Open the Xcode 11 beta or a newer version. In project settings, select target -> Signing & Capabilities, add Sign in with Apple.

Add Sign in with Apple from Xcode

Implementation Overview

1. Create a Sign In With Apple Button

2. Ask the User for Authorization

3. Verify the User Data Against Your Stored Data (Locally or From the Server).

At step 2, you will get a user credential.

if let credential = authorization.credential as? ASAuthorizationAppleIDCredential

Some information from credential is worth mentioning:

4. Handling the User Authorization Change

Users can always change their authorization for an app. It’s our job to know about the change early enough, and handle the change.

In order to handle the change, we need to store the user identifier
information received from step 3.

Then, in AppDelegate, we just pass the user identifier to ASAuthorizationAppleIDProvider to verify, and you may receive the following states:

Please note that users can remove an app’s authorization from the iOS settings page at any time, so we need to check it regularly.

Better Programming

Advice for programmers.

Thanks to Zack Shapiro


Written by


Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade