18

我会通过 Apple JS 在网络上使用“使用 Apple 登录”。代码示例可以在这里找到:https ://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple

现在的问题是:什么是客户端 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 的请求。

4

1 回答 1

19

客户端 ID 是启用了“使用 Apple 登录”的服务 ID的“标识符” :

服务标识配置

Apple 建议您在注册服务 ID 屏幕上将其设置为以下格式:

我们建议使用反向域名样式字符串(即,com.domainname.appname)。它不能包含星号 (*)。

于 2019-06-04T18:27:45.743 回答