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

How to configure credentials to connect to an OData v4 service?

emorales
Explorer
0 Likes
656

I have a CAP application uploaded to my CloudFoundry space with authentication using oauth2. Logging in through the application routing works fine. Now I want to create a Fiori application and in the DataSource configuration section I select the "Connect to an OData Service" option. I add the "OData service URL" and it asks me for two pieces of information that I didn't know: Service username and Service password. According to what I was investigating, within Sap BTP Cockpit there is the connectivity section.

I configured the following:

emorales_1-1723065370973.png

When I click on Check connection:

emorales_2-1723065412467.png

Could someone explain to me what I am doing wrong to receive that I am not authorized?

How do I get it to recognize my user? In my xs-security.json I have the following:

{
  "xsappname": "auditoria",
  "tenant-mode": "dedicated",
  "scopes": [
    {
      "name": "$XSAPPNAME.Auditor",
      "description": "Auditor"
    }
  ],
  "attributes": [],
  "role-templates": [
    {
      "name": "Auditor",
      "description": "generated",
      "scope-references": [
        "$XSAPPNAME.Auditor"
      ],
      "attribute-references": []
    }
  ],
  "oauth2-configuration": {
    "credential-types": [
      "binding-secret",
      "x509"
    ],
    "redirect-uris": [
      "https://*.applicationstudio.cloud.sap/**",
      "https://*.hana.ondemand.com/**"
    ]
  }
}

 xs-app.json:

{
  "authenticationMethod": "route",
  "logout": {
    "logoutEndpoint": "/app-logout",
    "logoutPage": "/"
  },
  "routes": [
    {
      "source": "^/app/(.*)$",
      "target": "$1",
      "localDir": ".",
      "cacheControl": "no-cache, no-store, must-revalidate",
      "authenticationType": "xsuaa"
    },
    {
      "source": "^/appconfig/",
      "localDir": ".",
      "cacheControl": "no-cache, no-store, must-revalidate"
    },
    {
      "source": "^/user-api(.*)",
      "target": "$1",
      "service": "sap-approuter-userapi"
    },
    {
      "source": "^/(.*)$",
      "target": "$1",
      "destination": "srv-api",
      "csrfProtection": true,
      "authenticationType": "xsuaa"
    }
  ]
}

 

emorales_4-1723065712400.png

I appreciate the help, thanks

Accepted Solutions (0)

Answers (0)