Skip to content

Sharaal/ai-first-oauth-maxdome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Setup for api.ai

  • Client ID and Client Secret will be ignored
  • Supported Grant type is Implicit
  • Authorization URL is the URL to the deployed service with the path /signin

Get the linkedAccount by the token

const Request = require('drequest').Request;

const linkedAccount = async (accessToken) => {
  if (!accessToken) {
    return;
  }
  const data = await new Request().post('https://ai-oauth-maxdome.herokuapp.com/linkedAccount', { body: { accessToken } });
  return data.linkedAccount;
};

linkedAccount structure

const linkedAccount = {
  autoLoginPin: 'autoLoginPin',
  customer: { customerId: 'customerId' },
  sessionId: 'sessionId',
}
  • autoLoginPin: Can be ignored, will be used by the service during the /linkedAccount to renew the session
  • customerId and sessionId are needed to make a sessioned maxdome request

Use the linkedAccount for maxdome requests, e.g. add an asset to the notepad

const maxdome = require('drequest-maxdome').getRequestBuilder();
const SessionOptions = require('drequest-maxdome').SessionOptions;

const assetId = 'assetId';

await maxdome.post('v1/mxd/notepad/%customerId%', [
  { body: { contentId: assetId } },
  new SessionOptions(linkedAccount),
]);

About

OAuth bridge generating implicit tokens for maxdome sessions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published