Coder Social home page Coder Social logo

sap-archive / analytics-cloud-apis-oauth-client-sample Goto Github PK

View Code? Open in Web Editor NEW
10.0 6.0 4.0 16.76 MB

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

License: Other

CSS 11.05% JavaScript 45.52% HTML 43.43%
sample sap-analytics-cloud sap-blogs oauth-client

analytics-cloud-apis-oauth-client-sample's Introduction

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.

analytics-cloud-apis-oauth-client-sample's People

Contributors

btbernard avatar jonathanbaker7 avatar virattiwari7 avatar voelpa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

analytics-cloud-apis-oauth-client-sample's Issues

Can I bypass confirmation screen ?

Dear

Sample seems to work fine.
I have a question.

After authentication by Logon, a confirmation screen (Do you want to authorize SSO_CLT to access your data of application approuter) appears.
Is there any way to omit this screen?

regards Yondong

Uh oh. Something went amiss.

I'm trying to show a story using this code but got this error instead, cannot see anything on the log of nodeJS, any idea? btw let me tell you that cannot understand why the tutorials are deprecated, there will be some missunderstandings with that, there are options on OAuth side that doesnt appear already (Authorization code on Security, for example). Don't know how to keep going

Thank you so much

Regards

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.