1

Example of how to authenticate and embed Pyramid content.

Below is a simple example of a web page that displays Pyramid content and authenticates to the Pyramid Embed API in order to create a cookie for authentication. You must have the embed add on included in your licence for the embed feature to work.


1) Replace the div tag with one of your report div tags as shown in the screenshot below:

Click on the Action panel on the content you want to embed>Click on the "embed" icon">choose copy without the script (see attached screenshots)

  
2) Add a username and password from your pyramid system that has access to the content. If you need to add your AD domain name it should be included with the username so domain\\UserName
3) Update the 2 lines in bold to your Pyramid 2018 URL

Its important to note that the file you create should be saved as a html file and run from a web server.

<html>
 <head>
 <meta charset="UTF-8">
 </head>
 <body>
  <!-- add the jquery & js-cookie scripts -->
  <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.0/js.cookie.min.js"></script>

<div data-id="cee1d574-1a9c-48d1-8825-2bae245c4f12" data-type="discovery" class="pyramid-embed pyramid-auto" style="width:1000px;height:400px;" data-host="http://PyramidURL.com"></div>

<script>
  function GetAuthentication(userName, password) {
    var credentials = {data: {userName: userName, password: password,domain: document.domain}};

$.ajax({ 
    type: "POST",
    url: "http:// PyramidURL.com /API/auth/authenticateUserEmbed",
    data: JSON.stringify(credentials),
    }).done(function(token){
    Cookies.set('PyramidEmbeddedAuth', token);
    pyramidInit();
    });
  };

if (Cookies.get('PyramidEmbeddedAuth') == null) {
    GetAuthentication("USERNAME", "PASSWORD");
  }
  </script>

<script src="http://PyramidURL.com/no-shell/embed.js"></script>

</body>
</html>

For further reading on how to use the embed feature please see our online help section here

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
reply to topic
Like1 Follow
  • 1 Likes
  • 1 mth agoLast active
  • 127Views
  • 1 Following