-
Notifications
You must be signed in to change notification settings - Fork 322
Description
In the past we used CF Java client version 3.13.0.RELEASE in our Spring Boot application. We are using a configuration to create the CloudFoundryClient as bean, which we are using later on to call the REST API. The REST API is triggered via scheduler once a week. This setup has worked for numerous months.
When we updated the CF Java client to version 3.21.0.RELEASE we get the following error after some time:
2020-05-27 00:25:57 ERROR org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler Unexpected error occurred in scheduled task org.cloudfoundry.reactor.util.Operator$ResponseReceiver$InvalidTokenException: null Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Assembly trace from producer [reactor.core.publisher.MonoCacheTime] : reactor.core.publisher.Mono.checkpoint(Mono.java:1877) org.cloudfoundry.reactor.tokenprovider.AbstractUaaTokenProvider.token(AbstractUaaTokenProvider.java:255) Error has been observed at the following site(s): |_ Mono.checkpoint ⇢ at org.cloudfoundry.reactor.tokenprovider.AbstractUaaTokenProvider.token(AbstractUaaTokenProvider.java:255)
After some research this error seems to be related to the expiration of the Authorization/Refresh Token, where the TokenProvider is no longer refreshing the Refresh Token automatically. This seems to be a behaviour change between the two CF Java client versions. My understanding is that when using a TokenProvider (e.g. PasswordGrantTokenProvider) the credentials are provided once and the TokenProvider is taking care of refreshing the Refresh/Authorization Token, when necessary. Especially as a user of the client is not aware of when the toke is expiring.