Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Sample embedding SAP Analytics Cloud (SAC) in to third party websites using the SAC API

License

Notifications You must be signed in to change notification settings

SAP-archive/analytics-cloud-apis-oauth-client-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. To run the express- app locally, you need to install Node.js on your computer.
  2. Furthermore, you need to have access to an SAP Analytics Cloud system.

Download

  1. Please clone the repository: git clone https://github.com/SAP/analytics-cloud-apis-oauth-client-sample.git.
  2. 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

  1. Please make sure to have enabled iframe embedding on your tenant (cf. 2.1. Enable iFrame Embedding).
  2. 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.

  1. For one, you have to configure the server program. Please define the configuration in the file config.properties.
    1. 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).
    2. Enter the secret you specified in SAC (cf. 1.2.1. Registration Details).
    3. Enter the token & authorization URL (cf. 1.2.2. Obtaining the Access Token).
    4. Enter the redirect URI (cf. 1.2.1. Registration Details).
  2. For two, you have to configure the client program. Please define the configuration in the file config.js.
    1. Enter your tenant's URL and ID (cf. 2.2. Compose the URL).
    2. [Optional] Enter demo display parameters (cf. 2.2.1. Display Parameters).
    3. [Optional] Enter demo filter parameters (cf. 2.2.2. Filter Parameters).
    4. [Optional] Enter demo variable parameters (cf. 2.2.3. Variable Parameters).

Usage

  1. 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).
  2. Navigating to localhost:8080 in your Google Chrome browser, opens the login page.
  3. Clicking on login sends you to the authorization server’s authorization endpoint.
  4. 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.
  5. 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.
  6. 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.
  7. 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.

About

Sample embedding SAP Analytics Cloud (SAC) in to third party websites using the SAC API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •