1 authentication oauth ios expo
我正在使用 expo-apple-authentication 包在 React Native 中实现 apple-authentication。
下面是我在按钮的 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
}
}
}
Run Code Online (Sandbox Code Playgroud)
它应该返回我在范围内请求的身份验证令牌、全名和电子邮件,但它给我全名和电子邮件为空。
根据文档:
requestScopes (AppleAuthenticationScope[])(可选) - 您的应用请求访问的用户信息范围数组。请注意,用户可以选择在登录时拒绝您的应用程序访问任何范围。您仍然需要处理您请求的任何范围的空值。此外,请注意,请求的范围只会在每个用户第一次登录您的应用程序时提供给您;在后续请求中它们将为 null。
您可能已经登录过一次但没有捕获日志。后续登录会导致该数据为空
| 归档时间: |
|
| 查看次数: |
1953 次 |
| 最近记录: |