gpt4 book ai didi

javascript - 如何在 Apple JS 中使用 "Sign In with Apple"

转载 作者:太空狗 更新时间:2023-10-29 14:12:20 26 4
gpt4 key购买 nike

我会通过 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”:

enter image description here

这是使用的代码:

<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 是您的 Service ID 的“标识符”启用了“使用 Apple 登录”:

Service ID Configuration

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 (*).

关于javascript - 如何在 Apple JS 中使用 "Sign In with Apple",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56442900/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com