title: Receiving a 'Forbidden (403)' when connecting to Power BI API
body: <p>We've been trying to follow <a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embed-sample-app-owns-data/" rel="nofollow noreferrer">this Power BI article</a> so that we can embed  reports/dashboards in our SaaS product. Specifically, we're stuck at Step 3, 'Create the Embed Token.'</p>
  
  <p>We're able to obtain an bearer token just fine but when the request to retrieve the reports is ultimately submitted to the API we receive:<em>Operation returned an invalid status code 'Forbidden'</em></p>
  
  <pre><code>    private static string clientId = "...";
      private static string secretKey = "...";
      private static string groupId = "...";
  
      static void Main(string[] args)
      {
          string resourceUri = "https://analysis.windows.net/powerbi/api";
          string authorityUri = "https://login.windows.net/common/oauth2/authorize";
  
          ClientCredential credential = new ClientCredential(clientId, secretKey);
          AuthenticationContext authContext = new AuthenticationContext(authorityUri);
  
          var token = authContext.AcquireTokenAsync(resourceUri, credential).Result.AccessToken;
  
          var tokenCredentials = new TokenCredentials(token, "Bearer");
  
          using (var client = new PowerBIClient(new Uri("https://api.powerbi.com/"), tokenCredentials))
          {
              var reports = client.Reports.GetReportsInGroupWithHttpMessagesAsync(groupId);
  
              // !!! - Here's where the exception is thrown
              // !!! -- Operation returned an invalid status code 'Forbidden'
              var report = reports.Result.Body;
          }
      }
  </code></pre>
  
  <p><strong>Here's what we've tried:</strong></p>
  
  <ul>
  <li>The required permissions have been granted (we've checked off all to ensure we're not missing anything). This includes both Windows Azure Active Directory/Power BI Service.</li>
  <li>We've confirmed that the client ID, secret key and group id are correct. </li>
  <li>The Power BI work-space is private, but we've tried making a public one to be sure it doesn't matter.</li>
  <li>Finally, the token we receive via code matches the token on powerbi.com.</li>
  </ul>