I am using Google Sign-In 5.0.2 with a Swift 4 iOS app. Here is my code to get a current id Token:
GIDSignIn.sharedInstance()?.currentUser?.authentication.getTokensWithHandler({ gidAuth, error in
if let error = error {
completion(.failure(error))
} else if let token = gidAuth?.idToken {
completion(.success(token))
} else {
assertionFailure("shouldn't have come here")
}
})
This works fine when I launch the app.
But if I leave the app running for an hour (to let the id token expire), then the next time getTokensWithHandler is called, it will not call my closure. Subsequent calls to getTokensWithHandler will once again call my closure.
I would like it to behave consistently so that my closure is always called, even if the token needs to be refreshed.
Anyone have any ideas on what I need to do to achieve this?
question from:
https://stackoverflow.com/questions/65892057/googlesignin-ios-gettokenswithhandler-doesnt-call-its-closure-after-token-has 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…