Giter Site home page Giter Site logo

Comments (5)

saphanaacademy avatar saphanaacademy commented on August 24, 2024 1

Hi Gregor,

Thanks for sharing the sample.

The latest version of the saphanaacademy-saas (0.0.5) and saphanaacademy-cap (0.0.60) generators now support accessing the CF API via a destination and Cloud SDK rather than via environment variables or SAP Credential Store. An instance destination appname-cfapi is created during MTA deployment (see the definition in mta.yaml).

After app deployment but before subscribing/unsubscribing a tenant, the instance destination appname-cfapi needs to have the user and password set (technical user recommended) and also the token service URL should have "login" changed to "uaa" at the beginning.

NB: The BTP cockpit requires fresh values for password and client secret whenever a URL is changed however client secret should be empty! Workaround this by entering a value for client secret and saving then re-editing and setting the client secret back to empty and saving again.

Hands-on video tutorials showing the whole process to come...

Best regards,
Philip

from generator-saphanaacademy-saas.

piejanssens avatar piejanssens commented on August 24, 2024 1

Hi Philip,

Just a quick FYI regarding this topic:

  • The secret being mandatory (while not indicated as mandatory): I filed this in incident 4093127 / 2022
  • Using uaa instead of login in the URL does not seem to make a difference, so this instruction can be left out. If there is a difference, I'd be interested to know how it differs.

Best regards,

Pieter

from generator-saphanaacademy-saas.

saphanaacademy avatar saphanaacademy commented on August 24, 2024

Hello Gregor,

Thanks for your feedback and the suggestion. Indeed using environment variables is not a great option.

The equivalent capability in the CAP generator already offers the possibility to use the SAP Credential Store rather than environment variables.

However using the destination service is another excellent option - we'll look at incorporating that in the future.

Best regards,
Philip

from generator-saphanaacademy-saas.

gregorwolf avatar gregorwolf commented on August 24, 2024

Hi Philip,

please find here a first sample how to call the Cloud Foundry API using a Destination

const { executeHttpRequest } = require("@sap-cloud-sdk/core");

const destination = {
  destinationName: process.env.CFAPI_DESTINATION || "CFAPI",
};

async function getOrganizations() {
  const response = await executeHttpRequest(destination, {
    method: "get",
    url: "/v3/organizations",
  });
  return response.data;
}

module.exports = { getOrganizations };

The configuration is straight forward. Please note that the Client Secret is empty:

Screenshot 2022-01-29 at 00 32 52

Don't think that Credential Store is the right option as then you still have to maintain the URL and Token Service URL somewhere else.

Best Regards
Gregor

from generator-saphanaacademy-saas.

saphanaacademy avatar saphanaacademy commented on August 24, 2024

Here's the accompanying hands-on Video Tutorial

from generator-saphanaacademy-saas.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.