SAP CF XSUAA Service - Error Message: Invalid redirect <redirect_uri>/login/callback did not matched the registered values

Viewed 1238

Implementing SAP xsuaa service with java and deployed, accessing the application URL facing below issue.

enter image description here

1 Answers

Posting this problem solution as I faced and resolved.

Case 1: If you are using BAS (Business Application Studio) and deploying through mta file, make sure you have added forwardAuthToken: true for xsuaa service associated application instance.

in the mta file add the below properties.

requires:
      - name: my_xsuaa
      - name: MY_API
        group: destinations
        properties:
          name: MY_API
          url: '~{url}'
        forwardAuthToken: true

If it is not working after that then check your xs-security.json file

"oauth2-configuration": {
        "token-validity": 604800,
        "refresh-token-validity": 2592000,
        
        "redirect-uris":[
            "https://*.<your_uri>/login/callback"
        ]  
    }

Case 2: If deploying a java application below properties should be set in the menifest.yml file.

env:
    SESSION_TIMEOUT: 30
    destinations: >
        [{
            "name":"MY_API",
            "url" :"<you_java_application_uri>",
            "forwardAuthToken": true
        }
        ]
Related