Skip to Content
0
Aug 15, 2022 at 12:26 PM

Authorisation error by CAP service call from fiori elements app

214 Views Last edit Aug 15, 2022 at 06:44 PM 7 rev

Dear SAP professionals,

I created a Fiori Elements app using the "Fiori: open app generator". I connected this app to the CAP service, which requires a specific user role to use:

service CoolService @(requires : [

'cool_admin'

]) {

The xs-app.json file looks like this:

{
  "welcomeFile": "/index.html",
  "authenticationMethod": "route",
  "routes": [
    {
      "source": "^/api/(.*)$",
      "target": "/api/$1",
      "destination": "app-srv",
      "authenticationType": "xsuaa",
      "csrfProtection": false
    },
    {
      "source": "^/resources/(.*)$",
      "target": "/resources/$1",
      "authenticationType": "none",
      "destination": "ui5"
    },
    {
      "source": "^/test-resources/(.*)$",
      "target": "/test-resources/$1",
      "authenticationType": "none",
      "destination": "ui5"
    },
    {
      "source": "^(.*)$",
      "target": "$1",
      "service": "html5-apps-repo-rt",
      "authenticationType": "xsuaa"
    }
  ]
}  

I placed this app to the launchpad service and gave myself this role (cool_admin) in SAP BTP, so I will be able to use the app. I am able to see it in the launchpad and open it, however when the app sends a "read" event to the service, I get an authorisation error:

image.png

Does anybody know, how to fix this issue?

Kind regards,

Vsevolod

Attachments

image.png (5.9 kB)