ui5-community / ui5-ecosystem-showcase

A repository showcasing the UI5 tooling extensibility to combine OSS tools for UI5 application development.
https://ui5-community.github.io/ui5-ecosystem-showcase/
Other
192 stars 93 forks source link

401 in destination CF #551

Closed luizcarlospedrosogomes closed 2 years ago

luizcarlospedrosogomes commented 2 years ago

`> targetmngt@0.0.1 start /workspace

ui5 serve --config=uimodule/ui5.yaml --open index.html

info normalizer:translators:ui5Framework Using SAPUI5 version: 1.84.0

2.0#2021 12 06 20:27:29:779#+00:00#WARNING#/LoggingLibrary################PLAIN##Dynamic log level switching not available

info server:custommiddleware:cfdestination adding cf-like destination "target-mngt-api" proxying reqs to /target-mngt-api/(.*)

2.0#2021 12 06 20:27:30:054#+00:00#INFO#/approuter#####kwv4kneu##########kwv4kneu#PLAIN##Application router version 9.4.0

2.0#2021 12 06 20:27:30:058#+00:00#INFO#/Configuration#####kwv4kney##########kwv4kney#PLAIN##No COOKIES environment variable

2.0#2021 12 06 20:27:30:063#+00:00#WARNING#/Configuration#####kwv4knf3##########kwv4knf3#PLAIN##No authentication will be used when accessing backends. Scopes defined in routes will be ignored.

2.0#2021 12 06 20:27:30:064#+00:00#WARNING#/Configuration#####kwv4knf3##########kwv4knf3#PLAIN##Route with source /\/target-mngt-api\/(.*)/ does not require authentication. Defined scopes will be ignored.

REQUEST { url: 'https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials', headers: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8', accept: 'application/json;charset=utf-8' }, auth: { user: 'sb-clone4ef92030dbba42d89338784d87ed2152!b22482|destination-xsappname!b62', pass: '' }, callback: [Function: onResponse], method: 'POST' } REQUEST { url: 'https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials', headers: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8', accept: 'application/json;charset=utf-8' }, auth: { user: 'sb-dafa3193-1f8b-441f-921f-142fa9aa3960!b22482|html5-apps-repo-uaa!b424', pass: '' }, callback: [Function: onResponse], method: 'POST' } info server:custommiddleware:livereload Livereload server started!

2.0#2021 12 06 20:27:30:084#+00:00#INFO#/approuter#####kwv4kneu##########kwv4kneu#PLAIN##Application router is listening on port: 5000

REQUEST make request https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST make request https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials Server started URL: http://localhost:8080 REQUEST onRequestResponse https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 200 { 'cache-control': 'no-store', 'content-type': 'application/json;charset=UTF-8', date: 'Mon, 06 Dec 2021 20:27:31 GMT', pragma: 'no-cache', server: 'nginx', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-vcap-request-id': '904a0f11-7d36-4faa-69b7-4c5850dfce58', 'x-xss-protection': '1; mode=block', 'transfer-encoding': 'chunked', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST reading response's body REQUEST finish init function https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST response end https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 200 { 'cache-control': 'no-store', 'content-type': 'application/json;charset=UTF-8', date: 'Mon, 06 Dec 2021 20:27:31 GMT', pragma: 'no-cache', server: 'nginx', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-vcap-request-id': '904a0f11-7d36-4faa-69b7-4c5850dfce58', 'x-xss-protection': '1; mode=block', 'transfer-encoding': 'chunked', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST end event https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST has body https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 1872 REQUEST emitting complete https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST onRequestResponse https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 200 { 'cache-control': 'no-store', 'content-type': 'application/json;charset=UTF-8', date: 'Mon, 06 Dec 2021 20:27:31 GMT', pragma: 'no-cache', server: 'nginx', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-vcap-request-id': '6ca4b582-cf87-4c76-4ad3-58805cba9369', 'x-xss-protection': '1; mode=block', 'transfer-encoding': 'chunked', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST reading response's body REQUEST finish init function https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST response end https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 200 { 'cache-control': 'no-store', 'content-type': 'application/json;charset=UTF-8', date: 'Mon, 06 Dec 2021 20:27:31 GMT', pragma: 'no-cache', server: 'nginx', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-vcap-request-id': '6ca4b582-cf87-4c76-4ad3-58805cba9369', 'x-xss-protection': '1; mode=block', 'transfer-encoding': 'chunked', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST end event https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials REQUEST has body https://sub.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials 1859 REQUEST emitting complete https://.authentication.us10.hana.ondemand.com/oauth/token/?grant_type=client_credentials info server:custommiddleware:cfdestination proxying GET /target-mngt-api/api/v1/ to http://localhost:5000/target-mngt-api/api/v1/... REQUEST { uri: 'http://localhost:5000/target-mngt-api/api/v1/', callback: undefined } REQUEST make request http://localhost:5000/target-mngt-api/api/v1/ REQUEST { url: 'https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json', headers: { accept: 'application/json;charset=utf-8', authorization: 'Bearer eyJhbGciOiJSUzI1NiIsImprdSI6Imh0dHBzOi8vc3Byb2hhbmFjbG91ZHN1Yi5hdXRoZW50aWNhdGlvbi51czEwLmhhbmEub25kZW1hbmQuY29tL3Rva2VuX2tleXMiLCJraWQiOiJkZWZhdWx0LWp3dC1rZXktMTcxNDU5NjE1MyIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3MWE5MGRmNDM1MTQ0M2UxOTZlNTE5NDM3ZTI3YzYxYyIsImV4dF9hdHRyIjp7ImVuaGFuY2VyIjoiWFNVQUEiLCJzdWJhY2NvdW50aWQiOiI0ODM3NTVhZS0yN2E1LTRiMjktOGI1Ny01YmVhZDZjZDQxZjYiLCJ6ZG4iOiJzcHJvaGFuYWNsb3Vkc3ViIiwic2VydmljZWluc3RhbmNlaWQiOiJkYWZhMzE5My0xZjhiLTQ0MWYtOTIxZi0xNDJmYTlhYTM5NjAifSwic3ViIjoic2ItZGFmYTMxOTMtMWY4Yi00NDFmLTkyMWYtMTQyZmE5YWEzOTYwIWIyMjQ4MnxodG1sNS1hcHBzLXJlcG8tdWFhIWI0MjQiLCJhdXRob3JpdGllcyI6WyJ1YWEucmVzb3VyY2UiXSwic2NvcGUiOlsidWFhLnJlc291cmNlIl0sImNsaWVudF9pZCI6InNiLWRhZmEzMTkzLTFmOGItNDQxZi05MjFmLTE0MmZhOWFhMzk2MCFiMjI0ODJ8aHRtbDUtYXBwcy1yZXBvLXVhYSFiNDI0IiwiY2lkIjoic2ItZGFmYTMxOTMtMWY4Yi00NDFmLTkyMWYtMTQyZmE5YWEzOTYwIWIyMjQ4MnxodG1sNS1hcHBzLXJlcG8tdWFhIWI0MjQiLCJhenAiOiJzYi1kYWZhMzE5My0xZjhiLTQ0MWYtOTIxZi0xNDJmYTlhYTM5NjAhYjIyNDgyfGh0bWw1LWFwcHMtcmVwby11YWEhYjQyNCIsImdyYW50X3R5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJyZXZfc2lnIjoiMTQ1ZGI0ZmMiLCJpYXQiOjE2Mzg4MjI0NTEsImV4cCI6MTYzODg2NTY1MSwiaXNzIjoiaHR0cHM6Ly9zcHJvaGFuYWNsb3Vkc3ViLmF1dGhlbnRpY2F0aW9uLnVzMTAuaGFuYS5vbmRlbWFuZC5jb20vb2F1dGgvdG9rZW4iLCJ6aWQiOiI0ODM3NTVhZS0yN2E1LTRiMjktOGI1Ny01YmVhZDZjZDQxZjYiLCJhdWQiOlsidWFhIiwic2ItZGFmYTMxOTMtMWY4Yi00NDFmLTkyMWYtMTQyZmE5YWEzOTYwIWIyMjQ4MnxodG1sNS1hcHBzLXJlcG8tdWFhIWI0MjQiXX0.AS6j6flVcNad8uo7hTfTdjAqBnsffMQadp7XAJH0SQHXEvwTZxgRGznAFFeBLfr9BqVKcg5SZzqElNF7S_TvDRg0rtl-HPDlPqc0SrS9utKWExwJ52nABjrvSCG11v0U-WBPc8oqiZqOM6cOwp80t3pvBU4QsV7VE_eavmVJXb33gEte_hgPhDOyJghuBjUp-PG4uwqD2-uk1ZnERFUUz_Hw8JP9FNApZ8lbgS3tTGo1IOE20RSXp60ijVCzr3lVEo6ST2DQ55QikWpZj_jVK1cLkSo1KasNNHECMckQvIYcB-n-jbYVydpA2582RXonlTNRuaADnaFdFey32BX1LA' }, callback: [Function: onResponse], method: 'GET' } REQUEST make request https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json REQUEST onRequestResponse https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json 503 { 'content-length': '210', 'content-type': 'text/html', date: 'Mon, 06 Dec 2021 20:27:40 GMT', 'x-vcap-request-id': 'ef294194-3822-4d07-5223-acb51c87b721', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST reading response's body REQUEST finish init function https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json REQUEST response end https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json 503 { 'content-length': '210', 'content-type': 'text/html', date: 'Mon, 06 Dec 2021 20:27:40 GMT', 'x-vcap-request-id': 'ef294194-3822-4d07-5223-acb51c87b721', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload;', connection: 'close' } REQUEST end event https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json REQUEST has body https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json 210 REQUEST emitting complete https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json

2.0#2021 12 06 20:27:40:396#+00:00#ERROR#/Handler#####kwv4kun1####zJZaax0ym2WlgWUx1yNQTxKsqxNmwVQV######kwv4kun1#PLAIN##GET request to /target-mngt-api/api/v1/ completed with status 401 Authentication required

{"component_type":"application","component_id":"-","component_name":"-","component_instance":"0","layer":"[NODEJS]","organization_name":"-","organization_id":"-","space_name":"-","space_id":"-","container_id":"-","logger":"nodejs-logger","source_instance":"0","written_at":"2021-12-06T20:27:39.421Z","written_ts":1638822459421000000,"request_id":"","request_size_b":"","type":"request","request":"/target-mngt-api/api/v1/","method":"GET","remote_user":"","direction":"IN","x_forwarded_for":"","response_time_ms":976,"referer":"","correlation_id":"","tenant_id":"","tenant_subdomain":"-","level":"info","remote_host":"redacted","remote_port":"redacted","protocol":"HTTP/1.1","remote_ip":"redacted","request_received_at":"2021-12-06T20:27:39.421Z","response_status":401,"response_size_b":"","response_content_type":"","response_sent_at":"2021-12-06T20:27:40.398Z"} REQUEST onRequestResponse http://localhost:5000/target-mngt-api/api/v1/ 401 { 'x-request-id': 'kwv4kun1', 'cache-control': 'no-cache, no-store, must-revalidate', date: 'Mon, 06 Dec 2021 20:27:40 GMT', connection: 'keep-alive', 'transfer-encoding': 'chunked' } REQUEST finish init function http://localhost:5000/target-mngt-api/api/v1/ REQUEST response end http://localhost:5000/target-mngt-api/api/v1/ 401 { 'x-request-id': 'kwv4kun1', 'cache-control': 'no-cache, no-store, must-revalidate', date: 'Mon, 06 Dec 2021 20:27:40 GMT', connection: 'keep-alive', 'transfer-encoding': 'chunked'`

vobu commented 2 years ago

hard to say what you're trying to achieve here - please provide more details (e.g. ui5.yaml, xs-app.json) and some prose. error reason may be manyfold - while glancing through the log, it seems there's rather an issue with https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com/target-mngt-api/xs-app.json as the response is http 503- service unavailable

luizcarlospedrosogomes commented 2 years ago

I'm trying to connect UI5 to a REST API, built with Nest and hosted by BTP. We use the BTP role authorization/authentication pattern. So, in addition to this difficulty in finding the route, we will also have difficulties in authenticating the API and consuming it.

uimodule/webapp/ui5.yaml

specVersion: "2.2"
metadata:
  name: targetmngt_uimodule
type: application
resources:
  configuration:
    paths:
      webapp: uimodule/webapp
framework:
  name: SAPUI5
  version: 1.84.0
  libraries:
    - name: sap.ui.core
    - name: sap.m
    - name: sap.ui.layout
    - name: themelib_sap_fiori_3
server:
  customMiddleware:
    - name: ui5-middleware-livereload
      afterMiddleware: compression
      configuration:
        port: 35731
        path: uimodule/webapp
    - name: ui5-middleware-cfdestination
      afterMiddleware: compression
      configuration:           
        authenticationMethod: route        
        debug: true
        port: 5000        
        allowServices: true
        allowLocalDir: true
        xsappJson: xs-app.json
        destinations:
          - name: target-mngt-api
            url: https://target-management-api-kind-cat-az.cfapps.us10.hana.ondemand.com/
            forwardAuthToken: true
builder:
  customTasks:
    -  name: ui5-task-zipper
       afterTask: uglify
       configuration:
         includeDependencies: true
         archiveName: uimodule

/xs-app.json image

/mta.yaml

_schema-version: 3.2.0
version: 0.0.1
parameters:
  enable-parallel-deployments: true
modules:
  - name: target-manegement-ui
    type: nodejs
    path: approuter
    parameters:
      disk-quota: 512M
      memory: 128M
    requires:
      - name: targetmngt_destination
      - name: targetmngt_html5_repo_runtime
      - name: targetmngt_uaa
  - name: webapp_deployer
    type: com.sap.application.content
    path: deployer
    requires:
      - name: targetmngt_html5_repo_host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - name: uimodule
          artifacts:
            - dist/uimodule.zip
          target-path: resources/
  - name: uimodule
    type: html5
    path: uimodule
    build-parameters:
      builder: custom
      commands:
        - npm run build:uimodule --prefix ..
      supported-platforms: []
resources:
  - name: targetmngt_destination
    type: org.cloudfoundry.managed-service
    parameters:
      service-plan: lite
      service: destination
      config:
        HTML5Runtime_enabled: true
        version: 1.0.0
  - name: targetmngt_html5_repo_host
    type: org.cloudfoundry.managed-service
    parameters:
      service-plan: app-host
      service: html5-apps-repo
      config:
        sizeLimit: 100
  - name: targetmngt_html5_repo_runtime
    type: org.cloudfoundry.managed-service
    parameters:
      service-plan: app-runtime
      service: html5-apps-repo
  - name: targetmngt_uaa
    type: org.cloudfoundry.managed-service
    parameters:
      path: ./xs-security.json
      service-plan: application
      service: xsuaa

default-env.json (generade by cf default-env.json

    "VCAP_SERVICES": {
        "destination": [
            {
                "binding_guid": "575ca08f-1113-452f-a58c-b6828919dbb5",
                "binding_name": null,
                "credentials": {
                    "clientid": "sb-clone4ef92030dbba42d89338784d87ed2152!b22482|destination-xsappname!b62",
                    "clientsecret": "<removed by security>5$xZO22ra2bQDnOmlVzDwdJFL6bN4H6LCMjbllDfbdgMw=",
                    "identityzone": "<removed by security>sub",
                    "instanceid": "4ef92030-dbba-42d8-9338-784d87ed2152",
                    "tenantid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                    "tenantmode": "dedicated",
                    "uaadomain": "authentication.us10.hana.ondemand.com",
                    "uri": "https://destination-configuration.cfapps.us10.hana.ondemand.com",
                    "url": "https://<removed by security>sub.authentication.us10.hana.ondemand.com",
                    "verificationkey": "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjubdinW1F8GjJhpuE8YPKl4PKCmbcvLGnjbGZiuotPj+BdzrEh0D4oO72CYCJL/DLUCwdGyEu0Q1V5jUUtwJsV2A/C00uB1UL/+rFkuL6VW+s41kTICZboUFD2JHGMheJlz5CH4fGteoPHW8Fx6FJQMm31zl6XpJhORc1/HUz4YJFE3pTHomSa+GPGuvwrXRBkM5bTYZTj8CwyQivdRBhwigiZWjMs0cNyTL2thHuEaaztN39LIPZSjg+C/GLTMYnlJownVTgUKPZNeDu2O5YwDlPbFH9ro7Vv0m1Yu/oB+l7BKHa7whyzG6o8XDWVpPqmfV1iXHGxMSi2ZGZHZ7/wIDAQAB-----END PUBLIC KEY-----",
                    "xsappname": "clone4ef92030dbba42d89338784d87ed2152!b22482|destination-xsappname!b62"
                },
                "instance_guid": "4ef92030-dbba-42d8-9338-784d87ed2152",
                "instance_name": "targetmngt_destination",
                "label": "destination",
                "name": "targetmngt_destination",
                "plan": "lite",
                "provider": null,
                "syslog_drain_url": null,
                "tags": [
                    "destination",
                    "conn",
                    "connsvc"
                ],
                "volume_mounts": []
            }
        ],
        "html5-apps-repo": [
            {
                "binding_guid": "ce5d5867-e1cc-4b2b-bc55-4856b4276211",
                "binding_name": null,
                "credentials": {
                    "grant_type": "client_credentials",
                    "saasregistryenabled": true,
                    "sap.cloud.service": "html5-apps-repo-rt",
                    "uaa": {
                        "apiurl": "https://api.authentication.us10.hana.ondemand.com",
                        "clientid": "sb-dafa3193-1f8b-441f-921f-142fa9aa3960!b22482|html5-apps-repo-uaa!b424",
                        "clientsecret": "<removed by security>vMSbggh6iRlteIw2iG26-2GRW_V4L9CewX1wis=",
                        "credential-type": "binding-secret",
                        "identityzone": "<removed by security>sub",
                        "identityzoneid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                        "sburl": "https://internal-xsuaa.authentication.us10.hana.ondemand.com",
                        "subaccountid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                        "tenantid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                        "tenantmode": "dedicated",
                        "uaadomain": "authentication.us10.hana.ondemand.com",
                        "url": "https://<removed by security>sub.authentication.us10.hana.ondemand.com",
                        "verificationkey": "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjubdinW1F8GjJhpuE8YPKl4PKCmbcvLGnjbGZiuotPj+BdzrEh0D4oO72CYCJL/DLUCwdGyEu0Q1V5jUUtwJsV2A/C00uB1UL/+rFkuL6VW+s41kTICZboUFD2JHGMheJlz5CH4fGteoPHW8Fx6FJQMm31zl6XpJhORc1/HUz4YJFE3pTHomSa+GPGuvwrXRBkM5bTYZTj8CwyQivdRBhwigiZWjMs0cNyTL2thHuEaaztN39LIPZSjg+C/GLTMYnlJownVTgUKPZNeDu2O5YwDlPbFH9ro7Vv0m1Yu/oB+l7BKHa7whyzG6o8XDWVpPqmfV1iXHGxMSi2ZGZHZ7/wIDAQAB-----END PUBLIC KEY-----",
                        "xsappname": "dafa3193-1f8b-441f-921f-142fa9aa3960!b22482|html5-apps-repo-uaa!b424",
                        "zoneid": "483755ae-27a5-4b29-8b57-5bead6cd41f6"
                    },
                    "uri": "https://html5-apps-repo-rt.cfapps.us10.hana.ondemand.com",
                    "vendor": "SAP"
                },
                "instance_guid": "dafa3193-1f8b-441f-921f-142fa9aa3960",
                "instance_name": "targetmngt_html5_repo_runtime",
                "label": "html5-apps-repo",
                "name": "targetmngt_html5_repo_runtime",
                "plan": "app-runtime",
                "provider": null,
                "syslog_drain_url": null,
                "tags": [
                    "html5appsrepo",
                    "html5-apps-repo-rt",
                    "html5-apps-rt",
                    "html5-apps-repo-dt",
                    "html5-apps-dt"
                ],
                "volume_mounts": []
            }
        ],
        "xsuaa": [
            {
                "binding_guid": "ca1f0990-a1fa-4968-80f6-e5d18c58d736",
                "binding_name": null,
                "credentials": {
                    "apiurl": "https://api.authentication.us10.hana.ondemand.com",
                    "clientid": "sb-target-mngt-authentication!t22482",
                    "clientsecret": "<removed by security>RZtgV0nQQw=",
                    "credential-type": "instance-secret",
                    "identityzone": "<removed by security>sub",
                    "identityzoneid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                    "sburl": "https://internal-xsuaa.authentication.us10.hana.ondemand.com",
                    "subaccountid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                    "tenantid": "483755ae-27a5-4b29-8b57-5bead6cd41f6",
                    "tenantmode": "dedicated",
                    "uaadomain": "authentication.us10.hana.ondemand.com",
                    "url": "https://<removed by security>sub.authentication.us10.hana.ondemand.com",
                    "verificationkey": "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjubdinW1F8GjJhpuE8YPKl4PKCmbcvLGnjbGZiuotPj+BdzrEh0D4oO72CYCJL/DLUCwdGyEu0Q1V5jUUtwJsV2A/C00uB1UL/+rFkuL6VW+s41kTICZboUFD2JHGMheJlz5CH4fGteoPHW8Fx6FJQMm31zl6XpJhORc1/HUz4YJFE3pTHomSa+GPGuvwrXRBkM5bTYZTj8CwyQivdRBhwigiZWjMs0cNyTL2thHuEaaztN39LIPZSjg+C/GLTMYnlJownVTgUKPZNeDu2O5YwDlPbFH9ro7Vv0m1Yu/oB+l7BKHa7whyzG6o8XDWVpPqmfV1iXHGxMSi2ZGZHZ7/wIDAQAB-----END PUBLIC KEY-----",
                    "xsappname": "target-mngt-authentication!t22482",
                    "zoneid": "483755ae-27a5-4b29-8b57-5bead6cd41f6"
                },
                "instance_guid": "395d88f6-8380-46fe-971b-788241ad574b",
                "instance_name": "target-mngt-authentication",
                "label": "xsuaa",
                "name": "target-mngt-authentication",
                "plan": "application",
                "provider": null,
                "syslog_drain_url": null,
                "tags": [
                    "xsuaa"
                ],
                "volume_mounts": []
            }
        ]
    },
    "VCAP_APPLICATION": {
        "application_id": "73c815e6-f160-4e0f-8965-6bd0236e62fa",
        "application_name": "target-manegement-ui",
        "application_uris": [
            "<removed by security>mento-target-manegement-ui.cfapps.us10.hana.ondemand.com"
        ],
        "application_version": "9e3c8f9e-c35a-4e11-8f94-b43d723de515",
        "cf_api": "https://api.cf.us10.hana.ondemand.com",
        "limits": {
            "disk": 512,
            "fds": 32768,
            "mem": 128
        },
        "name": "target-manegement-ui",
        "organization_id": "dcb62efb-dc6d-42cb-b07d-70dc1cc6a270",
        "organization_name": "SCP_sprohana_cloud",
        "process_id": "73c815e6-f160-4e0f-8965-6bd0236e62fa",
        "process_type": "web",
        "space_id": "b5f9e514-488a-48eb-88c9-a7f6b2d6f0ce",
        "space_name": "Desenvolvimento",
        "uris": [
            "<removed by security>ento-target-manegement-ui.cfapps.us10.hana.ondemand.com"
        ],
        "users": null,
        "version": "9e3c8f9e-c35a-4e11-8f94-b43d723de515"
    },
    "DEPLOY_ATTRIBUTES": "{\n  \"app-content-digest\" : \"41E582B504A33757C5D9489543823573\"\n}",
    "SEND_XFRAMEOPTIONS": "false"
} 

package.json

  "name": "targetmngt",
  "version": "0.0.1",
  "scripts": {
    "start": "ui5 serve --config=uimodule/ui5.yaml  --open index.html",
    "build:ui": "run-s  build:uimodule",
    "test": "run-s lint karma",
    "karma-ci": "karma start karma-ci.conf.js",
    "clearCoverage": "shx rm -rf coverage",
    "karma": "run-s clearCoverage karma-ci",
    "lint": "eslint .",
    "build:mta": "mbt build",
    "deploy:cf": "cross-var cf deploy mta_archives/targetmngt_$npm_package_version.mtar",
    "deploy": "run-s build:mta deploy:cf",
    "serve:uimodule": "ui5 serve --config=uimodule/ui5.yaml",
    "build:uimodule": "ui5 build --config=uimodule/ui5.yaml --clean-dest --a --dest uimodule/dist --include-task=generateManifestBundle"
  },
  "devDependencies": {
    "@ui5/cli": "^2.8.1",
    "cross-var": "^1.1.0",
    "eslint": "^7.18.0",
    "karma": "^6.0.1",
    "karma-chrome-launcher": "^3.1.0",
    "karma-coverage": "^2.0.3",
    "karma-ui5": "^2.3.2",
    "mbt": "^1.1.0",
    "npm-run-all": "^4.1.5",
    "shx": "^0.3.3",
    "ui5-middleware-cfdestination": "^0.3.0",
    "ui5-middleware-livereload": "^0.5.1",
    "ui5-task-zipper": "^0.4.2"
  },
  "ui5": {
    "dependencies": [
      "ui5-middleware-livereload",
      "ui5-middleware-cfdestination",
      "ui5-task-zipper"
    ]
  }
}

struct preject generate by ui5-easy image

@vobu many thanks for the reply

I hope this information helps us. I don't know what else to do but replace ui5 with react (webcomponents ui5)

luizcarlospedrosogomes commented 2 years ago

I created in ui5.yaml a destination that doesn't exist, he just didn't complain. I think it must be some ui5-middleware-cfdestination problem image

vobu commented 2 years ago

@vobu many thanks for the reply

would you please be so kind and format your file postings properly? it's impossible to decipher the xs-app.json or ui5.yaml. Also, please delete any sensitive information such as the clientsecret from your post here!

in general, putting both xs-app.json and default-env.json into / is a good idea (also see #508).

luizcarlospedrosogomes commented 2 years ago

thanks for the feedback

the sensitive information has been edited.

xs-app.json and default-env.json are in the root

I've tried several settings within ui5.yaml all without effect.

but I can connect when the app is online (within BTP)

luizcarlospedrosogomes commented 2 years ago

The solution doesn't work!

The way I did it to work was the old way, having an approuter in the project root and giving a "npm start" inside the approuter. That way it authenticates in the api. image

luizcarlospedrosogomes commented 2 years ago

after regenerating the app with yo easyui5 again and updating to the latest version of cfdestination, the app is connecting from my localhost to destination and respecting the roles.

thanks