SAP-samples / successfactors-cloud-extension-docusign

An extension to SAP SuccessFactors powered by event notifications, integrated with DocuSign, electronically signed documents capabilities, that delivers a seamless and secure document fulfillment process from end-to-end.
https://community.sap.com/t5/technology-blogs-by-sap/btp-use-case-series-use-e-signatures-to-streamline-new-hire-onboarding/ba-p/13498716
Apache License 2.0
3 stars 3 forks source link

401 Unauthorized request issue #16

Closed rayyavu closed 7 months ago

rayyavu commented 12 months ago

Dear @jmsrpp and @nnicora,

We are currently in the process of implementing a similar approach in our project. Following the recent update to the Kyma host endpoint, we have duly modified the API rule host name. Concurrently, we've maintained the code structure in line with codes, while adapting the docker image specifics (Docker hub- Public repository - Pulled the image successfully).

Regrettably, upon integration with SuccessFactors, we encountered a "400" error with the event is triggering. Subsequent attempts to access the same URL via Postman resulted in a "401" issue. We would greatly appreciate your expertise and assistance in resolving this matter.

Looking forward to your guidance and support in overcoming these challenges. Kindly find the attached document and below images for your reference.

jmsrpp commented 12 months ago

Hi @rayyavu - when using the token in Postman, please assign it to an Authorization header with the value prefixed by Bearer. An HTTP 400 is a bad request, usually indicating the inbound payload doesn't match what the microservice expects. Can you collect any more details from the SuccessFactors message? Typically one or more of those entries are a link to more details.

rayyavu commented 11 months ago

Hello @jmsrpp,

As you pointed out, I've utilized the "Bearer" keyword and transmitted the token as a "Bearer" token, but unfortunately, the issue persists.

I made an attempt to retrieve the payload from SuccessFactors Execution Manager and attached it. It appears that only the "Seqnumber," "userId," and "StartDate" are being passed as part of the payload. I've attached the downloaded from SF instance.

jmsrpp commented 11 months ago

Hi @rayyavu - despite that, your Postman query is not authenticating properly. I suggest you use the built-in OAuth 2.0 capability to ensure you are able to access the endpoint. You do not need to manually retrieve and set the bearer token if you utilize this (maybe you are but the original request contained a query parameter called access_token ... make sure the authorization header is showing up properly and it the only way you are passing it):

image

Bottom line, your SuccessFactors system is authenticating against the Kyma endpoint successfully, but the request body associated with the payload is not what the microservice expects. Please check the pod logs in Kyma:

https://github.com/SAP-samples/successfactors-cloud-extension-docusign/blob/main/src/services/success-factor-service.js

This has debugging and logging that should notify what was wrong with the payload. Please collect the pod/deployment and share them in this issue. I should also point out that both the classic event subscriber and the oauth2 client in Kyma has been deprecated. As such, we will archive this repository by end of year but leave it accessible so that the core parts of the Kyma extension can be leveraged as desired.

jmsrpp commented 7 months ago

Closing the issue with suggested steps. Open a new one if issue persists, please.