菜鸟教程小白 发表于 2022-12-13 05:36:48

ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件


                                            <p><p>所以我正在使用 Apple 实现登录,模拟器上一切正常,我请求电子邮件,fullName 范围,身份验证 UI 显示,并且我可以获取数据,如下图所示:</p>

<p> <a href="/image/ZMMWq.png" rel="noreferrer noopener nofollow"><img src="/image/ZMMWq.png" alt="enter image description here"/></a>
<a href="/image/R3xUi.png" rel="noreferrer noopener nofollow"><img src="/image/R3xUi.png" alt="enter image description here"/></a> </p>

<p>但是在真实设备(iPadOS 13、iPad 2018)上测试时,UI 没有显示(它不会在 UI 上询问姓名和电子邮件),并且我无法从响应中获取电子邮件、fullName ,而且我也可以确认<code>authorizedScopes</code>为空,只能获取用户标识符</p>

<p> <a href="/image/LfMlS.png" rel="noreferrer noopener nofollow"><img src="/image/LfMlS.png" alt="enter image description here"/></a>
<a href="/image/TVeuP.png" rel="noreferrer noopener nofollow"><img src="/image/TVeuP.png" alt="enter image description here"/></a> </p>

<p>我认为这是一个错误,并将提交雷达,还在 Apple 开发者论坛上发布了一个讨论(但他们通常不会批准我的帖子,我不知道为什么)</p>

<p>如果这不是错误,有人可以告诉我如何解决这个问题吗?
谢谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>问题解决了! tl;博士</p>

<p><strong>这是预期行为</strong></p>

<p>由 Apple 工程师回答
(原帖链接:<a href="https://forums.developer.apple.com/thread/121496" rel="noreferrer noopener nofollow">https://forums.developer.apple.com/thread/121496</a>)</p>

<blockquote>
<p>Hi aslkdjalksdjasdasd,</p>

<p>This behaves correctly, user info is only sent in the ASAuthorizationAppleIDCredential upon initial user sign up. Subsequent
logins to your app using Sign In with Apple with the same account do
not share any user info and will only return a user identifier in the
ASAuthorizationAppleIDCredential. It is recommened that you securely
cache the initial ASAuthorizationAppleIDCredential containing the user
info until you can validate that an account has succesfully been
created on your server.</p>

<p>Patrick</p>
</blockquote>

<h2>2019/12/15 编辑</h2>

<p>Apple 的 Sign in with Apple 文档中也记录了此行为,请查看 <a href="https://developer.apple.com/documentation/signinwithapplerestapi/authenticating_users_with_sign_in_with_apple" rel="noreferrer noopener nofollow">documentation</a> .</p>

<blockquote>
<p>Ensure that your app relays the credentials and user information to your app servers.
<strong><em>The API collects this information and shares it with your app the first time the user logs in to the app using Sign in with Apple</em></strong>. If the user then uses Sign in with Apple on another device, the API doesn&#39;t ask for the user’s name or email again. It collects the information again only if the user stops using Sign in with Apple and later reconnects to your app.</p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/57545635/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/57545635/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件