Git Product home page Git Product logo

depdevkit's Introduction

Developer Enablement Program

Welcome to Developer Enablement Program helper

Setup

  • Populate the .env file in the project root and fill it as shown by the example values needed found in _dot.env

Local Dev

  • aio app run to start your local Dev server
  • App will run on localhost:9080 by default

By default the UI will be served locally but actions will be deployed and served from Adobe I/O Runtime.

Auth Microservice

The auth micro service is a service that we have created to simplify the process of getting an auth token for use in your training.

The service when run in Adobe App Builder will be hosted at https://{your_runtime_instance_endpoint/api/v1/web/dx-excshell-1/auth

The auth service requires the following input parameters

client_id=XXXXX
[email protected]
org_id=XXXXX@AdobeOrg
client_secret=XXXXX
private_key=XXXXX
meta_scopes=ent_dataservices_sdk

The service supports the option to output a psql for the tenant and sandbox if you pass in these options parameters

tenant_name=XXXXX
sandbox_name=XXXXX

The results from this micro service call will look like the following if the call was successful

{
    "access_token": "eyJhbGciOiJSUzI....",
    "expires_in": 86399992,
    "psql": "psql 'sslmode=require host=tenant__test_name.platform-query.adobe.io port=80 dbname=my__fake_sandbox_name:all user=3C9419175E9D393C0A495E39@AdobeOrg password=eyJhbGciOiJSUzI....'",
    "token_type": "bearer"
}

To use the auth service with postman you can include a Pre-request Script that will set enviroment variables.

This is an example of a POSTMAN Pre-request Script to set the ACCESS_TOKEN based on the training auth micro service call

const ERROR_MESSAGE = " not found in active environment. Please ensure the correct environment is selected and populated.";

function getAccessToken() {
    if (!pm.environment.get("IMS_ORG")) {
        throw new Error("IMS_ORG" + ERROR_MESSAGE);
    } else if (!pm.environment.get("TECHNICAL_ACCOUNT_ID")) {
        throw new Error("TECHNICAL_ACCOUNT_ID" + ERROR_MESSAGE);
    } else if (!pm.environment.get("IMS")) {
        throw new Error("IMS" + ERROR_MESSAGE);
    } else if (!pm.environment.get("API_KEY")) {
        throw new Error("API_KEY" + ERROR_MESSAGE);
    } else if (!pm.environment.get("META_SCOPE")) {
        throw new Error("META_SCOPE" + ERROR_MESSAGE);
    } else if (!pm.environment.get("PRIVATE_KEY")) {
        throw new Error("Ensure the Private Key is added to both INITIAL and CURRENT VALUES in the active Postman environment's PRIVATE_KEY variable");
    }

    const loginRequest = {
        url: 'https://27200-373coralcattle-stage.adobeio-static.net/api/v1/web/dx-excshell-1/auth',
        method: 'POST',
        header: 'Content-Type: application/json',
        body: {
             mode: 'urlencoded',
            urlencoded: [
                {key: "client_id", value: pm.environment.get("API_KEY")},
                {key: "technical_account_id", value: pm.environment.get("TECHNICAL_ACCOUNT_ID")},
                {key: "org_id", value: pm.environment.get("IMS_ORG")},
                {key: "client_secret", value: pm.environment.get("CLIENT_SECRET")},
                {key: "private_key", value: pm.environment.get("PRIVATE_KEY")},
                {key: "meta_scopes", value: pm.environment.get("META_SCOPE")},
                {key: "tenant_name", value: pm.environment.get("TENANT_ID")},
                {key: "sandbox_name", value: pm.environment.get("SANDBOX_NAME")}
            ]
        }
    };

    console.log("getting login based on data", loginRequest);

    pm.sendRequest(loginRequest, function (err, response) {
        console.log("call response", response);
        let token = response.json().access_token;
        pm.environment.set("ACCESS_TOKEN", token);
    });
}

getAccessToken();

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.