Getting email id value null as response during apple-authentication(在苹果身份验证期间获取电子邮件 ID 值 null 作为响应)
问题描述
我正在使用 expo-apple-authentication 包在 react native 中实现苹果身份验证.
I'm implementing apple-authentication in react native using expo-apple-authentication package.
下面是我在按钮的 onPress 上调用的代码.
Below is the code which I'm calling on button's onPress.
async handleSocialLogin() {
const { mutate, BB, onSuccess, navigation } = this.props;
try {
const result = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
Alert.alert(JSON.stringify(result))
// signed in
} catch (e) {
Alert.alert(e)
if (e.code === 'ERR_CANCELED') {
// handle that the user canceled the sign-in flow
} else {
// handle other errors
}
}
}
它应该返回我在范围内请求的身份验证令牌、Full_Name 和电子邮件,但它给我的 Full_Name 和电子邮件 null.
It should return me authentication-token, Full_Name and Email which I requested in scope but It is giving me null for Full_Name and Email.
推荐答案
根据文档:
requestedScopes (AppleAuthenticationScope[])(可选)- 您的应用请求访问的用户信息范围数组.请注意,用户可以在登录时选择拒绝您的应用访问任何范围.您仍然需要为您请求的任何范围处理空值.另外,请注意,请求的范围只会在每个用户第一次登录您的应用时提供给您;在随后的请求中,它们将为空.
requestedScopes (AppleAuthenticationScope[]) (optional) - Array of user information scopes to which your app is requesting access. Note that the user can choose to deny your app access to any scope at the time of logging in. You will still need to handle null values for any scopes you request. Additionally, note that the requested scopes will only be provided to you the first time each user signs into your app; in subsequent requests they will be null.
您可能已经登录过一次并且没有看到日志.后续登录将导致该数据为null
You have probably already logged in once and didn't catch the logs. Subsequent log in will result in this data being null
这篇关于在苹果身份验证期间获取电子邮件 ID 值 null 作为响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在苹果身份验证期间获取电子邮件 ID 值 null 作为响应


- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01