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 作为响应


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01