在 React Native 中使用 Apple 登录返回 null

car*_*rch 2 ios react-native apple-sign-in

我在 React Native 中使用 Apple 登录时遇到问题。起初,它返回带有值的电子邮件和姓名,但在第二次尝试中,它现在返回 null。

第一次尝试:

"email": c@gmail.com, "fullName": {"familyName": admin, "givenName": admin, "middleName": null, "namePrefix": null, "nameSuffix": null, "nickname": null},
Run Code Online (Sandbox Code Playgroud)

第二次尝试:

"email": null, "fullName": {"familyName": null, "givenName": null, "middleName": null, "namePrefix": null, "nameSuffix": null, "nickname": null},
Run Code Online (Sandbox Code Playgroud)

如何防止这种情况发生以及如何使用注销?谢谢你!

jn_*_*pdx 6

通过“使用 Apple 登录”,您只能在首次登录时获得电子邮件/姓名。您有责任存储该信息。来源:

\n
\n

仅当用户首次使用您的应用程序使用“Sign in with Apple”时,识别服务器才会返回用户状态。后续尝试不会返回此用户状态的任何信息,例如发生断开连接并重新连接后或从其他设备连接。

\n
\n

https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple

\n

另: https: //developer.apple.com/forums/thread/121496

\n

就注销而言,您不一定要通过“使用 Apple 登录”来执行此操作。如果您将凭据存储在设备上,则应将其从存储位置清除。此外,如果您正在使用其他服务(例如 Firebase)的凭据,您当然可以注销该服务。

\n

您没有说明您为此使用的库,但如果它是re​​act-native-apple-authentication,您可能需要参考此线程有关注销行为:https: //github.com/转化酶/react-native-apple-authentication/issues/10#issuecomment-611532131

\n

如果在 iOS 设备上,用户可以通过“设置”应用程序撤销“使用 Apple 登录”访问权限。另请参阅此相关问题:Logout from Apple-Sign In

\n