cancel
Showing results for 
Search instead for 
Did you mean: 

Build Apps POST call - HTTP 403 Error (Invalid CSRF Token)

JG_LEE
Explorer
179

Hello everyone.

I need your help on something about x-csrf-token problem.

I am making an web application that creates Sales Order to S/4HANA Cloud Public Edition by Build Apps.

Connection to S/4HANA is made by destination, and web application is deployed to my BTP subaccount's HTML5 Repository.

Screenshot under is the destination I set to S/4HANA Cloud Public Edition's "Sales Order(A2X)" OData V2 api.

JG_LEE_0-1735198976020.png

Type : HTTP

URL : https://{tenant}-api.s4hana.cloud.sap/sap/opu/odata/sap

Proxy Type : Internet

Authentication : Basic

 

<Additional Properties>

AppgyverEnabled : true

BuildApps.RequiresCsrf : true

HTML5.DynamicDestination : true

sap.applicationdevelopment.actions.enabled : true

sap.build.usage : odata_gen

sap.processautomation.enabled : true

WebIDEEnabled : true

 

Plus, I 

JG_LEE_1-1735199170534.png

As you can see, I added "BuildApps.RequiresCSRF = true" to my destination so I can see the CSRF token settings too.

However, as I deploy this application and try to create Sales Order, error occurs and I can see this error message in my HTML5 repository.

JG_LEE_2-1735199425169.png

What should I do to fix this problem??

 

View Entire Topic
CoenAmista
Explorer
0 Kudos

I have the same error when deploying the app in Workzone standard following the standard SAP Build procedure.

I created an app in SAP Build that I deployed in SAP Build to my Workzone instances. 

CoenAmista_0-1735637743052.png

This is app is succesfully added to my HTML5 repository and shown in workzone. There I assigned  the app to the role Everyone, to the correct group and to the correct portal page. It appears on the page. When clicking on the tile I have the error:

CoenAmista_1-1735637841027.png

When I go to the HTLM5 repository to have  a look at the error log. I have exactly the same error: 

CoenAmista_2-1735637930554.png

After I deployed the app and received the error I removed an existing app from the portal page. After adding it again (without removing it anywere else) it give the same error. 

Different situation but same error as above.  Since this I followd the the SAP Build best practice it should work out of the box. And it worked in the past. It there a misconfiguration in automatically created BTP destination? 

 

 

 

CoenAmista
Explorer
0 Kudos

I solved the issue.

  1. I removed the app from the HTML5 repository in Workzone.
  2. I redeployed the app from SAP Build apps
  3. Refreshed the HTML5 repository in Workzone
  4. Added the app to the role everyone en the portal page 

It worked. But also the other apps who had the same issue worked again.