Running Unoptimized aggregation from UI

Running Unoptimized aggregation from UI

This is my implementation of the idea by Angelo Mekenkamp to use a UI element to call unoptimized aggregation on a source. Although the styling needs a bit of work but it works.

The script is attached to the post, you will need TamperMonkey/ViolentMonkey to run this, for further details on the setup watch the following show and tell.

Just change the YourTenant to your Tenant’s name so that the script runs for the specific page

// @match        https://YourTenant.identitynow.com/ui/admin/*

Get the current Bearer Token with the following

    const response = await fetch(
        "https://"+currDomain+".identitynow.com/ui/session",
    );
    if (!response.ok) {
      throw new Error(`HTTP error: ${response.status}`);
    }
   
    const data = await response.json();

    const currentUrl = window.location.href;
    const sourceId = currentUrl.split(":")[4];

    const url = 'https://'+currDomain+'.api.identitynow.com/beta/sources/'+sourceId.toString()+'/load-accounts';
    console.log("in func");

    const finalAuth = "Bearer "+data.accessToken.toString();

Then prepare to send the following post request

  const settings = {
    "url": url,
    "type": "POST",
    "timeout": 0,
    "headers": {
      "Authorization": finalAuth
    },
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
     "data": frm
  };

Run UnOpt Aggregation.js (4.1 KB)

If you do not want to use it from TamperMonkey/ViolentMonkey, you can package it into an extension
undefined

3 Likes