Sitemap
IOS
IOS App Development
Apple Sign In

About Apple Sign In

4 min readMar 11, 2020

--

This is an emergency issue for most of the app who has already have other 3rd party login functions, and this is the reason:refer review guidelines. It’s maybe cause of apple wants to decrease the redirections among apps and shorten the process of user login, anyway, I make this short is that

if you are using other 3rd party login service, then don’t forget mine!

Press enter or click to view image in full size
review guideLine

And This article is focus on what you need to prepare and take cares of, there is a demo code on apple developer, so the programming part is not really a problem here.

  • User Guide
  • Certificates
  • Reference of Implement

User Guide

First of all, there is the reference, through the document I’ve concluded some summery.

  1. It’s more convenience to use apple’s default look, ASAuthorizationAppleIDButton has done everything in appearance for you.
  2. If you want to custom your button, and you have little flexible for creative either. Typically, you will have two types below :
Press enter or click to view image in full size
reference from apple developer

And there is a few points you may need to obey.
- Use the icon which are downloaded from apple, and better use SVG or PDF file.
- Don’t doing any modifies for the icon, included and not limited in colors, margins, ratio…
- Match the height of the logo file to the height of the button in any form.
- Using system font for title, and let the font size be 43% large of button’s height.
- The margin between the title and the right edge of the button should measure at least 8% of the button’s width.
- And others are that would you please don’t do too much modifies… so why you don’t just use what ASAuthorizationAppleIDButton offers you?

Certificates

This is personally a biggest trouble, you may need some information to let apple knows you and your api server.

  1. Apply your certificates, and offers Private key, App Bundle, App Key ID, Team ID to your server developer, cause there is a jwt that have to configured, including , and they may use private key to encrypt the json by the algorithm they declared in jwt.
    (refers here : https://developer.apple.com/documentation/signinwithapplerestapi/generate_and_validate_tokens,
    and here is another issue in stackoverflow that you may learn some: https://stackoverflow.com/questions/56459075/how-to-verify-code-from-sign-in-with-apple)
  2. Fetch userIdentifier, auth token, name, email,…from iOS SDK from client end by following codes.
Press enter or click to view image in full size

And how to apply Private key, App Bundle, App Key ID, Team ID,

1.You Need to be the role of App Manager or Account owner of apple developer account.
2. For getting Key ID and Private key, you have to enable the apple sign in service under your app’s identifier.

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Click Download, the stores the .p8 file, which is your private key.

and remember the key ID, this used by web API for identitity verifying

Press enter or click to view image in full size

Reference of Implements

Truly not a matter, after you knowing how to configure the jwt, so just attached code here.

client guide : https://developer.apple.com/documentation/authenticationservices/implementing_user_authentication_with_sign_in_with_apple?language=objc

server guide : https://developer.apple.com/documentation/signinwithapplerestapi

IOS
IOS App Development
Apple Sign In

--

--

李杰駿
李杰駿

Written by 李杰駿

工程師出身、曾落地上海東京台北工程團隊,現在是熱愛產品的團隊經營人,持續思考、學習及探索如何在有限的影響範圍內盡可能為生存同一片土地上的人們創造更大的發展空間,東亞市場與組織獲利、團隊經營、員工職涯發展間的共融互利是我當前最關注的議題.渴望更多交流,歡迎私訊 : linkedin.com/in/chiehchunlee