cancel
Showing results for 
Search instead for 
Did you mean: 

Authorisation error by CAP service call from fiori elements app

former_member708468
Participant
0 Kudos

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:

Does anybody know, how to fix this issue?

Kind regards,

Vsevolod

View Entire Topic
CarlosRoggan
Product and Topic Expert
Product and Topic Expert

Just little hint, before we get crazy, sometimes it is just a browser cache issue, so before digging deeper, just make sure to logout and login again, to make the role assignment become effective.
Apologies if you've already done.
Cheers,
Carlos

former_member708468
Participant
0 Kudos

Hello Carlos,

Thank you for your reply! I tried to clear my cache and log in again, but it didn't help.

Kind regards,

Vsevolod

former_member708468
Participant
0 Kudos

Hello Carlos,

Under further investigation I found out that I used the user with the same email adress but from the wrong IDP. Now the problem is fixed.

Kind regards,

Vsevolod

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vsevolod, thanks for posting the solution. Good to know, this is as well something we should always check whenever we have this kind of issues.
Cheers,
Carlos