Important Notice
This public repository is read-only and no longer maintained.
SAP Analytics Cloud API Demo App
This repository contains the accompanying source code for the blog post SAP Analytics Cloud APIs: Getting Started Guide (available on SAP Blogs or GitHub). We exemplify how third-party applications can access SAC content by using the authorization protocol OAuth 2.0.
This demo app is programmed in Node.js and uses the simple-oauth2 library.
Project Structure
- analytics-cloud-apis-oauth-client-sample
- docs
- public
- css
- img
- js - client program
- rsrc
- config.js - configuration for the client program i.e., tenant configuration (tenant URL & ID), demo parameters (demo stories/ filters/ variables)
- server-config
- config.properties - OAuth configuration for the server program (ID of the client, secret, token & authorization URL, redirect URI)
- LICENSE
- NOTICE
- README.md
- package.json
- views - html files
- server-app.js - server program (routing etc.)
Requirements
- To run the express- app locally, you need to install Node.js on your computer.
- Furthermore, you need to have access to an SAP Analytics Cloud system.
Download
- Please clone the repository:
git clone https://github.com/SAP/analytics-cloud-apis-oauth-client-sample.git
.
- Download all necessary npm packages by running
npm install
from the command line in your project root folder.
Configuration
The entire configuration is explained in our user guide (SAP Blogs/ GitHub). Below you can find a brief summary of the configuration process. We reference the sections of the user guide.
Configuration of the SAC Tenant
- Please make sure to have enabled iframe embedding on your tenant (cf. 2.1. Enable iFrame Embedding).
- Please make sure to have registered the demo app as OAuth client in SAC (cf. 1.1. Client Registration and 1.2.1. Registration Details).
Configuration of the Application
To start using the application, it needs to be configured.
- For one, you have to configure the server program. Please define the configuration in the file config.properties.
- Enter the client ID for your OAuth client. It has to be the ID you defined in SAC's administration page (cf. 1.1. Client Registration).
- Enter the secret you specified in SAC (cf. 1.2.1. Registration Details).
- Enter the token & authorization URL (cf. 1.2.2. Obtaining the Access Token).
- Enter the redirect URI (cf. 1.2.1. Registration Details).
- For two, you have to configure the client program. Please define the configuration in the file config.js.
- Enter your tenant's URL and ID (cf. 2.2. Compose the URL).
- [Optional] Enter demo display parameters (cf. 2.2.1. Display Parameters).
- [Optional] Enter demo filter parameters (cf. 2.2.2. Filter Parameters).
- [Optional] Enter demo variable parameters (cf. 2.2.3. Variable Parameters).
Usage
- As can be seen from the source code in server-app.js, the application runs on
localhost:8080
. Please start the server (e.g., in the folder analytics-cloud-apis-oauth-client-sample execute the console command npm start
or node server-app
).
- Navigating to
localhost:8080
in your Google Chrome browser, opens the login page.
- Clicking on login sends you to the authorization server’s authorization endpoint.
- After entering your user credentials for the Identity Provider (IdP), please click on authorize to get an access token. Once you have the access token, you can access protected resources on SAC. SAC's default IdP is the SAP Cloud Platform Identity Authentication Service.
- Please enter parameter values (or, if specified, choose demo parameters by clicking on Demo Parameters). The tooltip next to a parameter provides an explanation for the corresponding parameter. It may also be helpful to read 2. SAC URL API.
- After having entered parameter values, click on Generate URL. In the text area above of the iframe, you see the URL that has been generated.
- Click on Load URL to visualize the SAC story within the iframe.
Troubleshooting
In case the story is not visualized in the iframe (i.e., the iframe's background remains white), it is very likely that some cookies have been blocked. Make sure to have allowed cookies for the domain of your IdP. If necessary, allow additional cookies by clicking on the cookies-icon in Chrome's address bar.
Support
Should you have any problems, please create a new issue.
Contributions
Currently we do not accept any external contributions to this project.
License
Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
This file is licensed under SAP SAMPLE CODE LICENSE AGREEMENT, v. 1.0 except as noted otherwise in the LICENSE file.