集成AppleID登錄

背景

自蘋果推出了Sign in with Apple功能后,很快審核指南就加入 4.8 :使用第三方登錄的App,都必須接入AppleID登錄 。已經(jīng)上架的 App 需在 2020 年 4 月 前完成接入工作, 新老App一樣對待。

基本流程

image.png

App

1.首先需要配置Sign In with Apple

image.png

2.生成私鑰。勾選Sign In with Apple,->Configure,選擇Primary App ID,生成新的.p8私鑰。

image.png

image.png

3.項目中配置Capability

image.png

4.集成AuthenticationServices.

官方提供了ASAuthorizationAppleIDButton(繼承自UIControl),來創(chuàng)建按鈕。

privateletappleButton:ASAuthorizationAppleIDButton={letbutton=ASAuthorizationAppleIDButton(authorizationButtonType:.signIn,authorizationButtonStyle:.white)returnbutton}()

按鈕樣式有white、whiteOutline、black三種,Api部分比較簡單,直接看代碼就好了。

值得一提的是,現(xiàn)在Apple明顯嚴(yán)肅了對AppleID登錄功能的UI規(guī)范審核,聽聞很多小伙伴的App也都因這個問題而審核被拒,我這里也提一下。基本小伙伴收到的都是下面的這種被拒原由:

Guideline 4.0 - Design

We noticed an issue in your app that contributes to a lower quality user experience than Apple users expect:

Your app uses Sign in with Apple as a login option but does not use Sign in with Apple button design, branding and/or user interface elements appropriately as described in the Sign in With Apple Human Interface Guidelines.

這個問題,只要大家認(rèn)真閱讀https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons并按照上面的要求修改,都不會再有問題。

ASAuthorizationAppleIDCredential信息釋義:

User ID:? 蘋果用戶唯一標(biāo)識符,該值在同一個開發(fā)者賬號下的所有 App 下是一樣的,開發(fā)者可以用該唯一標(biāo)識符與自己后臺系統(tǒng)的賬號體系綁定起來。

Verification data:Identity token,code驗證數(shù)據(jù),用于傳給開發(fā)者后臺服務(wù)器,然后開發(fā)者服務(wù)器再向蘋果的身份驗證服務(wù)端驗證本次授權(quán)登錄請求數(shù)據(jù)的有效性和真實性

Account information:? 蘋果用戶信息,包括全名、郵箱等

Real user indicator: 用于判斷當(dāng)前登錄的蘋果賬號是否是一個真實用戶

AuthenticationServices 框架概述

1.Sign In with Apple使用Apple登錄

2.Password-Based Login基于密碼的登錄

3.Web-Based Login基于web的登錄

4.Enterprise Single Sign-On企業(yè)單點登錄SSO

5.AutoFill Credential Provider Support自動填充驗證提供者支持

6.Web Browser Authentication Session Support web瀏覽器認(rèn)證會話支持

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容