我正在实现苹果登录功能,这是我按下苹果按钮时的代码:
onAppleButtonPress = async () => {
// performs login request
const appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: AppleAuthRequestOperation.LOGIN,
requestedScopes: [
AppleAuthRequestScope.EMAIL,
AppleAuthRequestScope.FULL_NAME,
],
});
// Ensure Apple returned a user identityToken
if (!appleAuthRequestResponse.identityToken) {
console.log('no token');
throw 'Apple Sign-In failed - no identify token returned';
}
// Create a Firebase credential from the response
const {identityToken, nonce} = appleAuthRequestResponse;
const appleCredential = firebaseAuth.AppleAuthProvider.credential(
identityToken,
nonce,
);
//I WANT TO GET THE EMAIL HERE TO USE CHECK IT FROM FIREBASE IF EMAIL ALREADY EXISTS BY THIS CODE
firebaseAuth()
.fetchSignInMethodsForEmail(appleAuthRequestResponse.email)
.then(providers => {
});
}
在模拟器上可以运行,但在实际设备上邮件为null。有谁能帮忙吗?