如何在Apple JS中使用“使用Apple登录”

Han*_*shi 7 html javascript apple-sign-in

我会通过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>
Run Code Online (Sandbox Code Playgroud)

我没有对test.php的请求。

Kas*_*ars 8

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

服务ID配置

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

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

  • 只有 Apple 可以在 API 上调用 CLIENT ID,并在他们这边将其称为服务标识符。那是精神上的。 (6认同)
  • 正确 - 如果没有 Apple Developer 会员资格,则无法启用 Sign In with Apple。 (5认同)
  • 因此,如果没有开发人员成员身份,就无法实施“与Apple登录”? (2认同)