3

I am trying to read data from S4hana cloud. I configured the destination in cloud foundry where authentication type is OAuth2SAMLBearerAssertion.

and I wrote a little servlet also to get the data using VDM mechanism.

But I am getting below error when I am calling the endpoint

 Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequestFailedException: Failed to get access token: no valid JWT bearer found in "Authorization" header of request.
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.getCurrentJwt(TokenRequest.java:308)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.TokenRequest.requestTokenWithUserTokenGrant(TokenRequest.java:352)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.requestAccessToken(XsuaaService.java:135)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.XsuaaService.getServiceToken(XsuaaService.java:197)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceCommand.getAccessToken(DestinationServiceCommand.java:109)
   2018-10-09T15:34:52.84+0530 [APP/PROC/WEB/0] OUT     ... 31 common frames omitted

I have followed https://blogs.sap.com/2018/02/05/deep-dive-8-with-sap-s4hana-cloud-sdk-leverage-principal-propagation-via-oauth-2-when-consuming-a-business-api-from-s4hana-cloud/.

Sander Wozniak
  • 650
  • 8
  • 27
  • 1
    Possible duplicate of [Problem accessing S4Hana system when assessing via OAuth2Bearer Assertion authentication configure destination](https://stackoverflow.com/questions/52216943/problem-accessing-s4hana-system-when-assessing-via-oauth2bearer-assertion-authen) – Dennis H Oct 09 '18 at 10:34

1 Answers1

1

Have you setup security / configured an approuter?

The error message indicates a missing JWT in the request.

See also: https://blogs.sap.com/2017/07/18/step-7-with-sap-s4hana-cloud-sdk-secure-your-application-on-sap-cloud-platform-cloudfoundry/

Sander Wozniak
  • 650
  • 8
  • 27