401 indicates a unauthorized error, is the token in your case valid? Below sample actually works. For testing purpose, you can get a valid token in a quick way. Just replace the token and dashboardid in your case.
<html><script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script><script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script><script type="text/javascript"> window.onload = function () { var embedConfiguration = { type: 'dashboard', // change report to dashboard accessToken: 'yourTokenHere', //change report embed url to dashboard embed url embedUrl: 'https://app.powerbi.com/dashboardEmbed?dashboardId=yourdashboardid' }; var $reportContainer = $('#dashboardContainer'); var report = powerbi.embed($reportContainer.get(0), embedConfiguration); } </script> <div id="dashboardContainer"></div></html>