cancel
Showing results for 
Search instead for 
Did you mean: 

Using OAUTH Destination in SAPUi5 not working

chayanhardrock85
Discoverer

Hi All,

I have trying to consume SAP Business Document Service : document-information-extraction using SAPUi5 app.

Using BTP trial account , destination with Oauth2ClientCredentials created

Failing with 500 Internal Server Error

Destination

controller

var url = "/document-information-extraction/v1/document/jobs";
var ajaxRequest = {};
            ajaxRequest.url = url;
            ajaxRequest.method = "POST";
            ajaxRequest.headers = header;
            ajaxRequest.data = data;
            ajaxRequest.processData = false;
            ajaxRequest.contentType = false;
            ajaxRequest.mimeType = "multipart/form-data";
            ajaxRequest.success = successcallback.bind(this);
            ajaxRequest.error = failcallback.bind(this);
            jQuery.ajax(ajaxRequest);<br>

ui5.yaml

      backend:
       - path: /oauth
         destination: DocExtract
       - path: /document-information-extraction
         destination: DocExtract_CLONING<br>

xs-app.json

 "routes": [

    {
      "source": "^/document-information-extraction/(.*)$",
      "target": "/document-information-extraction/$1",
      "destination": "DocExtract_CLONING",
      "authenticationType": "none",
      "csrfProtection": false
    },

Error screenshot

Shubham_M
Participant
0 Kudos

Hello,
Is your metadata getting loaded properly? Also, can you try OAuth2UserTokenExchange in authentication type?

You can remove the <br> from ui5.yaml.

Thanks,
Shubham

chayanhardrock85
Discoverer
0 Kudos

Hi Shubham,

Even after changing Authentication type to OAuth2UserTokenExchange giving 500 internal server error.

With Regards

Chayan

harianantha
Participant
0 Kudos

Hi Chayan,

Any luck? I am also facing the same issue. Tried many ways but no solution was found.

Thank you!!

Accepted Solutions (0)

Answers (1)

Answers (1)

harianantha
Participant
0 Kudos

chayanhardrock85 Try this...

workingdestination.jpg

Elangovan
Explorer
0 Kudos

Hi Harikrishna

Is there any document to explain this destination creation? Am not sure how to configure the token service url.

Thanks

Elango