Comments (5)
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.
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 oflogin
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.
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.
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:
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.
Here's the accompanying hands-on Video Tutorial
from generator-saphanaacademy-saas.
Related Issues (8)
- Saas solution update issue HOT 2
- Using destination as tenant aware services HOT 5
- Destinations are not picking from tenant sub accounts HOT 10
- Do we need standalone/managed app router to get rea.authInfo.checkLocalScope()..? HOT 1
- What is the goal of the example in custom.js? HOT 2
- Simplify mta by defining global parameter appname HOT 2
- Not able to run command "npm install -g generator-saphanaacademy-saas"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-saphanaacademy-saas.