如何在 Apple JS 中使用 "Sign In with Apple"
How to use "Sign In with Apple" with Apple JS
我会通过 Apple JS 在网络中使用 "Sign In with Apple"。代码示例可以在这里找到:https://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple
现在的问题是:Client ID 是什么,我在哪里可以找到它。我在 https://developer.apple.com/account/resources/identifiers/list 上测试了应用程序 ID 的标识符,并测试了服务 ID 的标识符。如果我点击按钮并在 mac 上使用 Touch ID 进行验证,我会收到错误消息 "AUTH_ALERT_SIGN_UP_NOT_COMPLETED":
这是使用的代码:
<html>
<head>
</head>
<body>
<button id="sign-in-with-apple-button"> Sign In with Apple </button>
<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
<script type="text/javascript">
AppleID.auth.init({
clientId : 'unknown',
scope : 'email',
redirectURI: 'https://mytld/test.php',
state : 'DE'
});
const buttonElement = document.getElementById('sign-in-with-apple-button');
buttonElement.addEventListener('click', () => {
AppleID.auth.signIn();
});
</script>
</body>
</html>
我在 test.php 上没有收到任何请求。
客户端 ID 是启用了 "Sign In with Apple" 的 Service ID 的 "Identifier":
Apple 建议您在 Register a Service ID screen 上将其设为以下格式:
We recommend using a reverse-domain name style string (i.e., com.domainname.appname). It cannot contain an asterisk (*).
我会通过 Apple JS 在网络中使用 "Sign In with Apple"。代码示例可以在这里找到:https://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple
现在的问题是:Client ID 是什么,我在哪里可以找到它。我在 https://developer.apple.com/account/resources/identifiers/list 上测试了应用程序 ID 的标识符,并测试了服务 ID 的标识符。如果我点击按钮并在 mac 上使用 Touch ID 进行验证,我会收到错误消息 "AUTH_ALERT_SIGN_UP_NOT_COMPLETED":
这是使用的代码:
<html>
<head>
</head>
<body>
<button id="sign-in-with-apple-button"> Sign In with Apple </button>
<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
<script type="text/javascript">
AppleID.auth.init({
clientId : 'unknown',
scope : 'email',
redirectURI: 'https://mytld/test.php',
state : 'DE'
});
const buttonElement = document.getElementById('sign-in-with-apple-button');
buttonElement.addEventListener('click', () => {
AppleID.auth.signIn();
});
</script>
</body>
</html>
我在 test.php 上没有收到任何请求。
客户端 ID 是启用了 "Sign In with Apple" 的 Service ID 的 "Identifier":
Apple 建议您在 Register a Service ID screen 上将其设为以下格式:
We recommend using a reverse-domain name style string (i.e., com.domainname.appname). It cannot contain an asterisk (*).