I downloaded XS_JSCRIPT14_10-70001363
package from Service Marketplace.
Please suggest me how to run this App Router Login form with localhost
I am trying with npm start
command, but getting UAA service exception. How to handle from localhost.

- 159
- 14
2 Answers
EDIT: Turns out I was incorrect, it is apparently possible to run the approuter locally.
First of all, here is the documentation for the approuter: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/01c5f9ba7d6847aaaf069d153b981b51.html
As far as I understood, you need to provide to files to the approuter for it to run locally, default-services.json
and default-env.json
(put them in the same directory as your package.json
.
The default-services.json
has a format like this:
{
"uaa": {
"url" : "http://my.uaa.server/",
"clientid" : "client-id",
"clientsecret" : "client-secret",
"xsappname" : "my-business-application"
}
}
The default-env.json
is simply a json file holding the environment variables that the approuter needs to access, like so:
{
"VCAP_SERVICES": <env>,
...
}
Unfortunately, the documentation does not state which variables are required, therefore I cannot provide you with a working example.
Hope this helps you! Should you manage to get this running, I'm sure others would appreciate if you share your knowledge here.

- 589
- 4
- 10
-
Thank you for your reply, then please suggest me how to run my destination application with login form in locally. – Dama Ramesh Nov 15 '18 at 12:20
-
Turns out I was incorrect, please see my updated answer. Hope this helps you somewhat. – Dennis H Nov 15 '18 at 13:32
-
Thank you very much Dennis, Now I am able to run approuter package in my local with `http://localhost:5000` – Dama Ramesh Nov 16 '18 at 10:05
When you download the approuter, either via npm
or service marketplace you have to provide two additional files for a basic setup inside the AppRouter directory (besides package.json
, xs-app.json
, etc.).
The default-services.json
holds the variables that tell the approuter where to find the correct authentication server (e.g., XSUAA). You have to provide at least the clientid, clientsecret, and URL of the authorization server as part of this file like this:
{
"uaa": {
"url" : "http://my.uaa.server/",
"clientid" : "client-id",
"clientsecret" : "client-secret",
"xsappname" : "my-business-application"
}
}
You can get this parameters, for example, after binding on SAP Cloud Platform, CloudFoundry your application to an (empty) instance of XSUAA where you can retrieve the values via cf env <appname>
from the `VCAP_SERVICES/xsuaa' properties (they have exactly the same property names).
In addition, you require the default-env.json
file which holds at least the destination variable to which backend microservice you want to send the received Json Web Token to. It may look like this:
{
"destinations": [ {
"name": "my-destination", "url": "http://localhost:1234", "forwardAuthToken": true
}]
}
Afterwards, inside the approuter directory you can simply run npm start
which runs the approuter per default under http://localhost:5000
. It also writes nice console output you can use to debug the parameters above.

- 350
- 6
- 10
-
Thank you very much Philipp, Now I am able to run approuter package in my local with `http://localhost:5000` – Dama Ramesh Nov 16 '18 at 10:03
-
Philipp, Now I am trying to run my business application(`http://localhost:8080`) with `spring-security.xml ` in local. I am getting below exception. what i have to set in environment. `org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'offlineTokenServices' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Environment variable VCAP_SERVICES not set;` – Dama Ramesh Nov 16 '18 at 10:53
-
Please raise a new question for this matter as it may require more details to document. – Philipp Herzig Nov 16 '18 at 10:59