cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to fetch data from on-premise system to cap application

sairampadarthi
Explorer
0 Kudos

Hi,

Iam uanble to get data from on premise system to cap application getting unauthorised error when iam clicking service as below.

can anyone please help me out.

Thanks in advance,

sairam

Accepted Solutions (0)

Answers (1)

Answers (1)

martinstenzig
Contributor
0 Kudos

Can you share your package.json. Without knowing more I would say you might have run `cds add xsuaa` without the `-- for production` parameter and now your development configuration also wants to see a jwt token for every request.

sairampadarthi
Explorer
0 Kudos

Hi Martin,

Thanks for quick response. Below is my package.json file

Do you have any blog or steps to follow the process.

Thanks,

Sairam

martinstenzig
Contributor
0 Kudos

A couple of questions:

1. Do you get the unauthorized error just for the SAP call or for any service call in this project?

2. Go to the root of the project and run the following 4 commands and let us know what the results are:

a. cds env requires.auth.kind --for development

b. cds env requires.auth.strategy --for development

c. cds env requires.auth.kind --for production

d. cds env requires.auth.strategy --for production

3. If you want to use the PR API to update information (but even more as best practice) you should add "csrf":true to your API definitions. See https://cap.cloud.sap/docs/node.js/remote-services#csrf-token-handling