facebook
itechnolabs-telephone
itechnolabs-whatsapp

How to Integrate the New ‘Sign in with Apple’ Button in iOS App [Updated]

how to integrate the new sign in with apple button in ios app itechnolabs

The new ‘Sign In with Apple’ was a hot topic during Apple’s 2019 Worldwide Developers Conference. Users can now use their Apple IDs and either Face ID or Touch ID biometric security to sign in to apps and websites that support Apple’s Sign In with Apple single sign-on (SSO) feature. This is just one of several new privacy-focused features in iOS 13.

Sign In with Apple has the potential to improve the user experience for app developers and publishers by reducing the hassle of account creation, sign-in, and onboarding. However, this could restrict companies’ ability to market to app users outside of the app itself, as publishers would not have access to users’ email addresses and names unless the company specifically requests it.

However, supporting this new feature is a no-brainer for any iOS app that requires account sign-in. This is especially true if your app already integrates with other SSO providers like Google or Facebook. If your app doesn’t support these other SSO options, you’ll need to integrate Sign In with Apple by the end of 2019. After the 2022 Worldwide Developers Conference (WWDC), Apple introduced a new sign-in with an Apple button that developers of iOS apps will need to support. Now the question is how to implement this. Here’s how to add the new ” Sign in with Apple ” button to your iOS app.

Also, read: What is iBeacon, and Why is it used in iOS Apps Development?

Here are some crucial steps to Integrate New ‘Sign in with Apple’ Button in iOS App

here are some crucial steps to integrate new sign in with apple button in ios app itechnolabs

Step 1: Thing you need to do is create an Apple Developer Account.

Navigate to the Identifiers section of your Apple Developer Account, select your app’s identifier from the list on the left, and then click Save.

Select Sign In with Apple from the list of Capabilities, select Edit, choose to Enable as the primary App ID, and finally, select Save.

Confirm and save your changes.

Select the Keys tab on the left side and return here.

You can add a new key by clicking the plus sign next to the ‘Keys’ heading.

Select the box to enable Sign In with Apple after providing a name.

Select your primary App ID by clicking the Configure button and then click the Save button.

Just hit the Next button, then the Register button, and finally the Finish button. (There is no need to save the key to your computer, as we will not be implementing ‘Sign in with Apple’ on this site.)

(Optional) You’ll need to add their domain and email address to get in touch with your users.

As I mentioned at the outset, using Apple’s “Sign in with Apple” feature allows users to remain anonymous during the login process.

Setting up a domain and a contact email address in your Apple Developer Account will allow you to communicate with those customers.

Pick More on the left, then hit the Configure button.

Then, enter your domain name and email address on the following page and click the Register button for each.

Click the Download button and save the.txt file to your computer to confirm the domain.

Create a folder on your FTP server called. Well-known (yes, with the dot), and then upload the file.

Check if you get any text when you type in “https://PUT YOUR DOMAIN HERE.com/.well-known/apple-developer-domain-association.txt” to see if the domain association is being read.

Then, afterwards, return and click the Verify button. (It could be a while before Apple can “see” the file on your server.)

Step 2: Implement Apple’s “Sign in with Apple” feature.

To add a new capability, head into your project, select your project from the left sidebar, click Signing & Capabilities, and finally click + Capability.

To add your Apple ID, double-click the Sign in with Apple button in the new window (or search for it by typing “apple”).

Step 3: Include a “Sign in with Apple” button.

There are two options for displaying the “Sign in with Apple” option.

To avoid having your app rejected during the review, style your button by Apple’s Sign in with Apple – Human Interface Guidelines, or use the class ASAuthorizationAppleIDButton.

Adding an Apple ID Authorization button (ASAuthorizationAppleIDButton) is the first available choice.

Update your LoginViewController with the necessary instructions:

Choice 2: Inserting a User-Defined Button

If you’d prefer to use a different button than the ASAuthorizationAppleIDButton class does, insert the following code into your LoginViewController.

Step 4: Collecting Information from End Users

The AuthenticationServices framework should be included at the very beginning of your swift file.

To handle authorization responses, incorporate the ASAuthorizationControllerDelegate delegate into your class.

In addition, we need to set the window in which we wish to display the authorization process by adding the ASAuthorizationControllerPresentationContextProviding.

To your LoginViewController class, add the following method:

In this procedure, we specify the information we’re looking for from the user, in this case, their full name and email address.

We report the error if authentication fails and the user’s id, first name, last name, and email address if it succeeds.

Step 5: Add your email to your “White List.”

The Apple Sign-In system prioritizes user anonymity. As I mentioned, users can keep their personal email addresses hidden from the developer. To send emails directly to users, you’ll need to have your domain and the emails you send allowed. You can do it by following these steps:

  • Remember to sign into your Apple developer account.
  • Certificates, Identifiers, and Profiles can be chosen.
  • Please choose the “More” option.
  • Click Configure next to Apple ID Sign-In.

Make sure you have a domain name and email address set up for correspondence,

Step 6: Verify the User’s Authentication

Get the current state of the user’s credentials by calling the getCredentialState method on the ASAuthorizationAppleIDCredential.

The ‘Sign in’ screen is displayed if the user has removed our app from the list of those with access to their Apple ID; otherwise, the ‘User’s Profile’ screen is displayed as before.

Step 7: Allow users to sign in with Apple’s Keychain

As a developer, you can integrate both Signs In with Apple and Apple’s Keychain login system. Step 4’s button handling needs to be revisited so that a new authentication provider, PasswordProvider, can be set up and the appropriate code can be added.

Put in place password provider support in your delegate function that handles authentication.

Password credentials are simple to manage. Obtaining the necessary login credentials is as simple as entering them into your server.

Step 8: Check the user’s current status

That’s a crucial next move. Users can sign out of your app and stop using Apple ID. You can deal with it when the user first launches the app or in real time.

  • As a first option, when your app is launched.

If the user decides to switch SSO providers and no longer use Apple ID, you should log them out of your app when they relaunch it. The following method, which is tied to your ASAuthorizationAppleIDProvider, must be implemented in order to determine the current user’s authorization status. Be sure to take notes on the appropriate code for each scenario:

  • Way two: Whilst your app is active

If you want to keep tabs on any changes made to the user’s Apple ID session, you can do so by adding an observer for the CredentialRevoked event. During the active app session, ensure the object containing the observer keeps its instance.

In what way does “Sign in with Apple” benefit you?

  • One word: personal space

With recent scandals involving privacy and security breaches at Google and Facebook, this announcement is a welcome relief.

Probably in a dig at Apple’s rivals, Apple’s head of software engineering Craig Federighi said, “Sign in with Apple” is a fast, easy way to sign in, without all the tracking. Simply the user’s name and email address are stored. In addition, the app gives the user the option of keeping their email address secret.

  • Beyond that, it provides:

First, safety

When a user chooses to “Sign In with Apple id,” their account is immediately secured with two-factor authentication. A biometric authentication system, such as Touch ID or Face ID, is used in addition to the standard username and password.

Second, a number of different media are available.

There is native support for Apple’s iOS, macOS, tvOS, and watchOS. Also, you can use it in cross-platform adaptations of your apps and on your website. Users of Android and web-based apps are directed to a “web view” of the app, where they must tap “Sign in with Apple” and enter their Apple ID and password to complete the sign-in process.

Third, Stopping Fraud

Using sophisticated machine learning, it can notify you of suspicious activity when a user creates an account in your app who is (likely) not a natural person.

The developer can use this warning to process their additional anti-fraud measures or grant permission to app features.

Fourthly, single-use logins

If the app detects that the user already has an account, it will notify them and ask if they’d like to use that email address to sign in.

Important Article: Top 10 Skills To Consider When you hire iOS Developers

Do you want to make add-on features on Your Mobile apps From iTechnolabs?

do you want to make add-on features on your mobile apps from itechnolabs

The instructions in this post should primarily apply to the Mac, Apple TV, Apple Watch, and iOS/iPadOS gadgets (iPhone, iPad, and iPod touch) with some tweaking. Apple provides a JavaScript software development kit (SDK) to ensure the portability of applications across platforms (the experience is provided through a Webview).

The next step is to test the integration of Sign In with Apple into your backend. This authorization flow needs to be rigorously tested alongside other major app updates and features to ensure a smooth transition for existing users to Sign In with Apple.

Apple’s built-in Sign In feature provides a safe, two-factor authentication mechanism for your app and is simple to implement. Any app that only requires an email address for signup and setup should add support for this.

FAQs to Integrate the New ‘Sign in with Apple’ Button in iOS App

1. How to sign up for developer accounts with Apple and Android?

Follow the following steps and sign up for developer accounts with Apple –

  • First of all, make absolutely sure that you have done everything that Apple wants you to do before you sign up
  • Obviously, the very next step is to create a brand new Apple ID, only in case you do not own one
  • Fill up the form for the sign-up. You must read carefully all the information and requisite agreements before you sign up
  • Make the required payment through the given payment gateways and wait for the confirmation for the sign-up

The steps given below informs you of sign up process for the developer accounts with Android –

  • Create a brand new Google account for sign-up process for Google Play Console, if you do not have one
  • Obviously, fill the whole sign-up form after giving a careful read to the given information and agreements
  • Pay for the sign-up process and wait for the confirmation

2. What are the top iPhone app development companies in New York?

Given below is the list of leading iPhone app development companies in New York –

  • iTechnolabs
  • Utility
  • Launchpad App Development
  • Quytech
  • RipenApps
  • Snotor
  • AppsChopper
  • Blue Label Labs
  • Fueled
  • Cubix
Looking for Free iOS App Development Consultation?
Talk to our experts to create native or hybrid mobile apps for Your Business!
Need Help With iOS App Development?
Are You Looking for iPhone App Development Company?
Need Help With iOS App Development?

We trust that you find this information valuable!

Schedule a call with our skilled professionals in software or app development