08-09-2022 10:31 AM - edited 02-04-2024 4:18 AM
Using CAP and SAP Cloud SDK to retrieve a destination of OAuth2SAMLBearerAssertion type.
We are currently using the following destination config:
In our CAP application, we are trying to access the destination using:
DestinationAccessor.getDestination(Constants.DEFAULT_S4_HANA_CLOUD);
However when we get the following error:
Failed to read authentication token. The destination service responded with an error: Retrieval of OAuthToken failed due to: Cannot determine user to propagate for OAuth2SAMLBearerAssertion destination. Either provide user_token JWT token (https://docs.cloudfoundry.org/api/uaa/version/4.7.1/index.html#user-token-grant) when retrieving the destination or configure it with SystemUser.
How can this be possible if I am able to get the token via the following?
AuthToken currentToken = AuthTokenAccessor.getCurrentToken();
AuthToken xsuaaServiceToken = AuthTokenAccessor.getXsuaaServiceToken();
I have also tried to authenticate with the token passed i.e.
AuthTokenAccessor.executeWithAuthToken(currentToken, () -> DestinationAccessor.getDestination(Constants.DEFAULT_S4_HANA_CLOUD));
Are we missing a crucial step in the process? Has anyone encountered this issue before?
How are we able to correctly pass the AuthToken to the destination?
Thanks in Advance!
Here you go Erlo,
kind regards; Piotr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Erlo,
You can refer to the document https://help.sap.com/docs/CP_CONNECTIVITY/cca91383641e40ffbe03bdc78f00f681/6e5e004b6553403486a03da53... and the blog https://blogs.sap.com/2021/05/10/oauth2samlbearerassertion-flow-with-the-sap-btp-destination-service..., which explains this ins detail
Thanks and Regards,
Prasanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Erlo,
Additionally, you can refer to this reply in the blog that I've shared. https://blogs.sap.com/2021/03/24/oauth2samlbearerassertion-flow-with-the-sap-btp-destination-service.... A solution for a similar problem you are facing is shared here.
Best Regards,
Prasanth
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.