如何使用“使用Apple登录"使用Apple JS [英] How to use "Sign In with Apple" with Apple JS

查看:617
本文介绍了如何使用“使用Apple登录"使用Apple JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would use "Sign In with Apple" in the web via Apple JS. The code example can be found here: https://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple

现在的问题是:什么是客户ID,在哪里可以找到它.我在 https://developer.apple.com/account/上测试了应用程序ID的标识符资源/标识符/列表,然后我测试了服务ID的标识符.如果我单击按钮并在Mac上使用Touch ID进行验证,则会收到错误"AUTH_ALERT_SIGN_UP_NOT_COMPLETED":

The question now is: what is the Client ID and where can I find it. I tested the identifier of the app id on https://developer.apple.com/account/resources/identifiers/list and I tested the identifier of the service id. If I click on the button and verify with Touch ID on my mac, I got the error "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没有要求.

I got no request on test.php.

推荐答案

客户端ID是您已启用使用Apple登录"的服务ID :

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

Apple recommends you make it the following format on the Register a Service ID screen:

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

We recommend using a reverse-domain name style string (i.e., com.domainname.appname). It cannot contain an asterisk (*).

这篇关于如何使用“使用Apple登录"使用Apple JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆