title: Angular5 PowerBI Embed not working
body: <p>I am trying to get a sample power BI embed (user owns data mode) working in an angular5 application. Below is what I have done so far:</p>
  
  <ol>
  <li>Installed powerbi &amp; powerbi client npm packages.</li>
  <li>I have created an AAD app and given all access to powerbi apis.</li>
  </ol>
  
  <p>Below is the code of my component:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import * as pbicli from 'powerbi-client';
  import {AuthenticationService} from '../authentication';
  @Component({
    selector: 'app-powerbi-qna',
    templateUrl: './powerbi-qna.component.html',
    styleUrls: ['./powerbi-qna.component.scss']
  })
  export class PowerbiQnaComponent implements OnInit {
  embedToken: string;
    constructor(private authSvc: AuthenticationService) { }
  
    ngOnInit() {
      // get embed tokens
  
      this.loadDashboard();
    }
  loadDashboard() {
  // Read embed application token from textbox
  this.displayDashboard(this.authSvc.getCachedToken());
  }
  displayDashboard(token: string) {
  const embedUrl = 'https://app.powerbi.com/reportEmbed?reportId=&lt;reportid&gt;';
  const embedReportId = '&lt;reportid&gt;';
  const config = {
      type: 'report',
      tokenType: 0,
      accessToken: token,
      embedUrl: embedUrl,
      id: embedReportId,
      permissions: 7,
      settings: {
      }
  };
  // Get a reference to the embedded report HTML element
  const embedContainer = &lt;HTMLElement&gt;document.getElementById('powerBiEmbed');
  const powerbi = new pbicli.service.Service(pbicli.factories.hpmFactory, pbicli.factories.wpmpFactory, pbicli.factories.routerFactory);
  // Embed the report and display it within the div container.
  const report = powerbi.embed(embedContainer, config);
  // Report.off removes a given event handler if it exists.
  report.off('loaded');
  // Report.on will add an event handler which prints to Log window.
  report.on('loaded', function() {
    console.log('Loaded');
  });
  report.on('error', function(event) {
    console.log(event.detail);
      report.off('error');
  });
  report.off('saved');
  report.on('saved', function(event) {
      console.log(event.detail);
   });
  }
  }
  </code></pre>
  
  <p>But things are not working and I get below exception in console:
  <strong>GET <a href="https://wabi-west-europe-redirect.analysis.windows.net/metadata/cluster" rel="noreferrer">https://wabi-west-europe-redirect.analysis.windows.net/metadata/cluster</a> 403 (Forbidden)</strong> </p>
  
  <p>I am trying to access the powerbi using the loggedin user's license (User owns data)
  What am I missing here?</p>