Apple Worldwide Developers Conference 2019 lead to many tech-centric announcements that are set to change the face of the industry. A chief among them was the mechanism to let third-party apps authenticate users using their Apple IDs. This new feature is projected as a secure and privacy-friendly way for iOS users to create accounts in apps. Most iOS and Mac users already have an Apple ID, and with this new feature they can use an Apple ID to sign in to other apps and websites. ‘Sign in with Apple’ is going to be a major tech trend in the upcoming year and we at Promatics are here to help fellow budding app development experts learn a few tricks of the trade.
Apple’s new requirement that app developers must implement the company’s new single sign-on solution, Sign In with Apple has taken the app world by storm. With the motive of giving customers a more private choice from a security perspective, signing in with Apple will allow an enhanced overall customer experience for users. With Apple sign-in users can be sure that the apps aren’t sharing their information with an entity they don’t trust. Users also get to decide if they want to share their mailing address with app developers. If a user decides against it, Apple comes to their rescue by generating real and verified email address for the app in question. Apple thus routes the emails the app wants to send to that generated email address, which can be easily disabled at any time. Features like built-in two-factor authentication support, anti-fraud detection and one-touch frictionless entry into the app are some other conveniences of signing in with Apple. It is a better solution when compared to other social login systems that users count on. However, this particular feature will only be compatible with versions iOS13 and later.
In this article we take you on a step by step guide on ‘ How to Integrate Sign in with Apple with Your App?’
However, if you are just an app business owner looking to upgrade your mobile app with these new functionalities, get in touch with our team of iOS experts at Promatics. We have distinct experience of developing numerous iOS applications for various kind so businesses and can easily integrate sign-in with Apple into your app product. If you are an app developer on the other hand, you would appreciate that Apple adopted the existing open standards OAuth 2.0 and OpenID Connect to use as the foundation for their new API. Apple has used the same terminology and API calls as OAuth 2.0 & OpenID Connect. App developers versed at these technologies, will find it easier to integrate Sign in with Apple into their app. Look ahead and find a guide to ‘How to Integrate Sign in with Apple with Your App?’
STEP 1 Select your App ID. Under Capabilities scroll down and activate Sign In with Apple.
STEP 2 Create a New Project in Xcode by open your project settings. Go to Signing & Capabilities and click on +Capability and type into the search pane until Sign In with Apple feature appears.
STEP 3 To add the “Sign in with Apple” Capability in your project, import the AuthenticationServices framework that provides the Sign In with Apple button view. Set up the button type and the style. Then set up an action as a UIControl object and add it to any view. Go to the “ViewController.swift” and Import ASAuthenticationServices framework (framework for “Sign In with Apple”). This provides the ASAuthorizationAppleID button.
STEP 4 After the UI and feature have been created, you need to connect it to Apple’s authorization flow. Create your ASAuthorizationAppleIDProvider and prepare its request with the scopes set to .fullName and .email, or any other option that you need. Then create your ASAuthorizationController and set the presentationContextProvider and the delegate.
STEP 5 Presentation Context Provider protocol allows the Sign In with Apple action sheet to be presented on top of your current app. If a user opts-in and grants you permission to access user name and email, authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) can be called. On the other hand, authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error)is called. There needs to be provisions to handle both and present the right information to the user upon completion.
STEP 6 Sign In with Apple enables users can hide their personal email from the developer. For direct communication to users by email you are required to white list your email domain and originator email. To do so:
a.) Log in to your Apple developer account.
b.) Select Certificates, Identifiers & Profiles.
c.) Go to More.
d.) Select ‘Configure’ under Sign In with Apple.
e.) Register your Domain and Emails for communication.
We all know that the announcement of single Sign-in feature by Apple has stirred the industry. With this move, Apple will not let apps see the user’s real email address. Apple will also provide the app with a proxy email address unique to each app. However, most app developers will still be able to send emails to the proxy addresses and users can decide if they want to shut off email forwarding per app. From an app developer’s perspective, this feature can be a game changer for iOS user experience enabling seamless onboarding of users. However, many iOS developers would find it a bit difficult to integrate it into the app they work on. The step by step guide will work for integrating sign in with Apple in most apps with minor adjustments for iOS/iPadOS devices (iPhone, iPad and iPod touch), the Mac, Apple TV, and Apple Watch.