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


基础教程推荐
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01