I have a thingsboard server and devices connecting to it. There are dashboards which show details of devices allowed for customer. Now we want to embed the dashboard in our web app/ionic app. We want to see the embedded dashboard without having to login to thingsboard. Is there a method to embed private dashboard by passing credentials/token via cookie, header or url

simply doing <iframe id="myframe" src="http://THINGSBOARDURL/dashboards/7c561ea0-60fa-11e9-89e4-7b63caf01c9a" width="100%" height="100%"></iframe> loads the login screen.

Based on a suggestion from gitter chat and some posts in SO, I tried

function populateIframe(token){


$.ajax({
  type: "GET",
  url: 'http://THINGSBOARDURL/dashboards/7c561ea0-60fa-11e9-89e4-7b63caf01c9a',
  success: function(data){

    //update iframe content
    myframe.attr('src',"/")
    myframe.contents().find('html').html(data); 

  },
  beforeSend: function(xhr, settings){
            xhr.setRequestHeader("X-Authorization", 'Bearer ' + token);},
  });
}

but it breaks all links. Dashboard page is loading scripts. I also tried createObjectURL with blob data but its address had origin of the calling page not the thingsboard url

0 Answers