首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Apple JS中使用“登录Apple”

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

Stack Overflow用户
提问于 2019-06-04 19:23:48
回答 1查看 10.3K关注 0票数 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":

下面是使用的代码:

代码语言:javascript
复制
<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上没有收到任何请求。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-05 02:27:46

客户端ID是启用了“用苹果登录”的Service ID的“标识符”:

苹果公司建议你在Register a Service ID screen上使用以下格式

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

票数 18
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56442900

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档