cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CORS error in Visual Studio Code

0 Likes
1,681

Hello, experts. I'm not so experienced in UI5 and decided to use Visual Studio Code to develop a new application. I generated a new project and added a service from my local npl installation. When I tried to run application I encountered the problem of CORS then I run Chrome in a special mode and the mistake was gone. However, the information is still not displayed on the screen and I see a strange error in the console "CSRF token validation failed - sap.ui.model.odata.v2.ODataModel". How can I avoid this mistake?

 
manifest file 
   "dataSources": {
      "http://vhcalnplci.dummy.nodomain:50000/sap/opu/odata/SAP/ZORDER_SRV/": {
        "uri": "http://vhcalnplci.dummy.nodomain:50000/sap/opu/odata/SAP/ZORDER_SRV/",
        "type": "OData",
        "settings": {
          "localUri": "localService/http://vhcalnplci.dummy.nodomain:50000/sap/opu/odata/SAP/ZORDER_SRV//metadata.xml"
        }
      }
    }
      "": {
        "type": "sap.ui.model.odata.v2.ODataModel",
        "settings": {
          "defaultOperationMode": "Server",
          "defaultBindingMode": "OneWay",
          "defaultCountMode": "Inline",
          "preload": true
        },
        "dataSource": "http://vhcalnplci.dummy.nodomain:50000/sap/opu/odata/SAP/ZORDER_SRV/"
      }
view.xml

      <Page title="{i18n>title}">
        <content>
          <Page id="Products" title="Available Products">
            <content>
              <List items="{/zord_warehouse_cds}">
                <StandardListItem type="Active" title="{name}" />
              </List>
            </content>
          </Page>   
        </content>
      </Page>

Accepted Solutions (0)

Answers (1)

Answers (1)

jhodel18
Active Contributor
0 Likes

Hi Fedor,

I have a blog post that talks about how you can use Fiori Tools + UI5 Tooling on VS Code where you can use proxy middleware to proxy out your backend OData service:

https://blogs.sap.com/2020/08/03/sap-fiori-tools-sapui5-freestyle-app