更新时间:2023-12-02 12:41:16
我们也有类似的实现,因此希望可以解决您的问题.
We have similar implementation, so hopefully this solves your problem.
if let currentUser = Auth.auth().currentUser {
currentUser.getIDTokenForcingRefresh(true) { error in
if let error = error {
// log out
} else {
// go in
}
}
} else {
// log in
}
这会强制Auth与Firebase通信以获取新的身份验证令牌,如果删除了用户,该令牌将失败.
This forces Auth to communicate with Firebase to get a new authentication token, which would fail if the user was deleted.