cloud-sdk-java
cloud-sdk-java copied to clipboard
TokenRequestFailedException when trying to access destinations with OAuth2ClientCredentials type Authentication
Issue Description
We are trying to connect to say a microserviceB from microserviceA. The destination is configured with OAuth2ClientCredentials authentication. We have a certificate which we have added in the destination and a clientId. We have url to call B and a token service url.
Expectation is that the microserviceA sdk library will make a connection to the destination with DestinationAccessor.getDestination(name) and internally generate the token with the tokenUrl and call the url to microserviceB.
But when the code - DestinationAccessor.getDestination(name); is called, I get the following exception.
com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.sdk.cloudplatform.resilience.ResilienceRuntimeException: com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.sdk.cloudplatform.security.exception.TokenRequestFailedException: Failed to resolve access token.
I can generate a token via client and call the microserviceB via a client.
Impact / Priority
Its a P1 - top priority for us as our code freeze for go live is on 22 August.
Affected development phase: Development closure soon
Impact: Blocked
Timeline: e.g. Go-Live is in 4 weeks
Error Message
com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.sdk.cloudplatform.resilience.ResilienceRuntimeException: com.sap.cloud.sdk.cloudplatform.thread.exception.ThreadContextExecutionException: com.sap.cloud.sdk.cloudplatform.security.exception.TokenRequestFailedException: Failed to resolve access token.
- SDK Version: 5.0.0
- Link to GitHub repo:
- Project type, for example:
- [ ] CAP Project
- Platform: both below
- [ ] Cloud Foundry
- [ ] Deploy with Confidence (Cloud Foundry)
Checklist
- [ ] Checked out the documentation and Stack Overflow
- [ ] Description provided with all relevant information
- [ ] Exception and stack trace provided
- [ ] Attached debug logs
- [ ] Attached dependency tree
- [ ] Provided Cloud SDK version & link to relevant source code