IT评测·应用市场-qidao123.com技术社区

标题: 【三方登录-Apple】iOS 苹果授权登录(sign in with Apple)之开辟者设置一 [打印本页]

作者: 尚未崩坏    时间: 2024-6-24 01:28
标题: 【三方登录-Apple】iOS 苹果授权登录(sign in with Apple)之开辟者设置一
记录一下sign in with Apple的开辟者设置
前言

   关于使用 Apple 登录 使用“通过 Apple 登录”可让用户设置帐户并使用其Apple ID登录您的应用程序和关联网站。首先使用“使用
Apple 登录”功能启用应用程序的App ID 。 如果您是初次启用应用程序 ID 或为新应用程序启用应用程序 ID,请启用该应用程序
ID 作为主要应用程序 ID。您可以单独使用主应用程序 ID,也可以通过分组为相关应用程序和网站启用标识符。 要为相关应用程序启用应用程序
ID(例如,Mac 应用程序的 iOS 版本的应用程序 ID),请将其与现有主应用程序分组。如果您的应用程序具有实用于多个 Apple
平台或您想要启用“使用 Apple 登录”功能的 Web 的版本,这会很有帮助。通过与现有主标识符分组而启用的应用程序 ID
不能用于通过分组启用其他标识符。您必要取消应用程序 ID 的分组并将其启用为主要应用程序 ID。
您可以通过在证书、标识符和设置文件中编辑应用程序 ID 设置来管理应用程序 ID 。

  一、设置Sign in with Apple

1.找到证书


2.创建新 app(web已有做关联) 并开启 Sign in with Apple


3.接下来新建一个新的 identifier,注意是 Services IDs


4.接下来在Configure 设置回调地点


确保 Primary App ID 是你要选用的app
注意回调地点那里的链接必须要有 https 开头
5.设置完成,页面显示无误后可以选取左边的 Key

怎么找到Sign in with Apple 回调地点?
1.Certificates, Identifiers & Profiles->Identifiers->右侧搜索筛选Services IDs



现在,你得到了 service ID, redirect URL, team ID, key ID, and private key. 接下来就可以开始第二部门 Sign In with Apple REST API.
clientId 是申请的serveic IDs 中的那个 identifier
6.网页前端设置

  1. <button id="sign-in-with-apple-button"> Sign In with Apple </button>
  2. <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
  3. <script type="text/javascript">
  4.     AppleID.auth.init({
  5.         clientId : 'xxxx',
  6.         scope : 'email',
  7.         redirectURI: 'https://dogfightx.com/',
  8.         state : 'DE'
  9.     });
  10.     const buttonElement = document.getElementById('sign-in-with-apple-button');
  11.     buttonElement.addEventListener('click', () => {
  12.         AppleID.auth.signIn();
  13.     });
  14. </script>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 IT评测·应用市场-qidao123.com技术社区 (https://dis.qidao123.com/) Powered by Discuz! X3.4