gpt4 book ai didi

ios - 火力地堡 : How to get email from sign in with apple on real device?

转载 作者:行者123 更新时间:2023-12-05 02:51:05 24 4
gpt4 key购买 nike

我正在用苹果实现登录,这是我按下苹果按钮的代码

  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 => {

});

}

它在模拟器上工作,但在真实设备上电子邮件为空。谁能帮忙?

最佳答案

Apple 仅在第一次登录时返回全名和电子邮件,在成功登录时它将返回 null,因此您需要保存这些数据。

要再次接收这些信息,请转到您的设备设置; 设置 > Apple ID、iCloud、iTunes 和 App Store > 密码和安全性 > 使用您的 Apple ID 的应用,点击您的应用,然后点击停止使用 Apple ID。您现在可以再次登录,您将收到全名和“电子邮件”。

来源here .

关于ios - 火力地堡 : How to get email from sign in with apple on real device?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63394524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com