I’m using the SecureCredentialsManager in an Android app. When the id token expires, getCredentials
throws CredentialsManagerException("No Credentials were previously set.")
. The documentation says it’s supposed to automatically renew the tokens with the refresh token when they expire.
The code causing this exception is:
val token = suspendCoroutine<String?> { cont ->
manager.getCredentials(object :
BaseCallback<Credentials, CredentialsManagerException> {
override fun onSuccess(credentials: Credentials) {
cont.resume(credentials.idToken)
}
override fun onFailure(error: CredentialsManagerException) {
cont.resumeWithException(error)
}
})
}
manager.hasValidCredentials() returns true before this code executes.