Secure Embed

 > Embed > Secure Embed

You can embed Dashboards in your site using the HTML <iframe> Tag.

 

This method Secure Embed works with a Trusted Authentication System.

How to Secure Embed #

Note
As a pre-requisite to make Secure Embed you need to create a Personal Access Token, learn how to create one here.

 

1º Make an API request of the type GET to the Viur Authentication system:

POST https://app.viurdata.com/authentication?username=(:username)

Change the parameter ?username= (:username) to an existing user e-mail in your Viur Team that you wish to authenticate.

Important Note
A Key named "Authorization" with the Value "Bearer (your created Personal Access Token)" should be added to Header section of the request.
You can learn more about Viur API requests here.

The response of the Request will return a token that is valid for 3 minutes (by default) that can be used to Authenticate automatically the user in question (:username).

 

2º Create an iframe with the obtained token:

To embed your Dashboard you need to obtain the Dashboard ID easily obtained in the URL while viewing a Dashboard.

url

 

Note
Also make sure the token you created is made from a User that has access to the Dashboard you want to embed.
Learn how to give permissions to a user here.

 

Take a look at this example:

<iframe 
    src="https://app.viurdata.com/authentication/(token)/dashboards/(dashboardID)"
    width="1275"
    height="400">
</iframe>

Note
Use the attributes width and height to set the iframe to a size of your liking.

You need to change:

  • (dashboardID) to the ID of the Dashboard you want to embed.
  • (token) to the response you got in the API Request of the 1º Step.

 

Tip
You can control the initial values of the variables of the dashboard by GET parameters in the URL like so:
src="https://app.viurdata.com/authentication/(token)/e655838e-50ad-4445-bb04-94c6aad2fa98?CountrySales=Portugal&CountrySales=Canada"

Example iframe:

 

There are two error outcomes:


The user in question does not have permissions to see the Dashboard:

Make sure the user in question has permissions.
insufficient

The token is invalid or expired:

Fix this by generating another token or check if it was pasted correctly in the URL.
invalid

 

Still need help? Get in touch!
Last updated on 16th Oct 2018