OGeek|极客世界-中国程序员成长平台

标题: ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 05:36
标题: ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件

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

enter image description here enter image description here

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

enter image description here enter image description here

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

如果这不是错误,有人可以告诉我如何解决这个问题吗? 谢谢



Best Answer-推荐答案


问题解决了! tl;博士

这是预期行为

由 Apple 工程师回答 (原帖链接:https://forums.developer.apple.com/thread/121496)

Hi aslkdjalksdjasdasd,

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.

Patrick

2019/12/15 编辑

Apple 的 Sign in with Apple 文档中也记录了此行为,请查看 documentation .

Ensure that your app relays the credentials and user information to your app servers. 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. If the user then uses Sign in with Apple on another device, the API doesn'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.

关于ios - 在真实设备上使用 Apple 登录时无法获取姓名和电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57545635/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4