Azure-Samples / powerbi-dotnet-server-aspnet-web-api

PowerBI sample demonstrating use of C# SDK for creating embed REST API
MIT License
9 stars 6 forks source link

Updated sample app to work with latest (1.1.1) version of PowerBI #2

Open mschulz531 opened 8 years ago

mschulz531 commented 8 years ago

mattmazzola, this is a great sample, thanks.

I've updated this sample app to work with latest (1.1.1) version of PowerBI; removed GetDevToken and replaced with new PowerBIClient constructor which uses AppKey; updated all NuGet packages to current versions.

Hopefully this will help someone else as your sample has helped me.

acomsmpbot commented 8 years ago

No issues were found in this pull request.

mattmazzola commented 8 years ago

I think it looks good overall, just has those two extra packages I mentioned in the other comments. I think it's better to only include the packages that are needed. This helps avoid confusion for people unfamiliar with the packages who might mistakenly think they are needed even though they are not.

mattmazzola commented 8 years ago

Hi, I was going to go ahead and merge this but I checked out your branch and tried running it locally and am receiving this error with Jwt package.

{
  "message": "An error has occurred.",
  "exceptionMessage": "Could not load type 'System.IdentityModel.Tokens.JwtSecurityToken' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.",
  "exceptionType": "System.TypeLoadException",
  "stackTrace": "   at Microsoft.PowerBI.Security.PowerBIToken.Generate(String accessKey)\r\n   at PbiPaasWebApi.Controllers.ReportsController.<Get>d__6.MoveNext() in C:\\Users\\mattm\\Source\\Repos\\powerbi-dotnet-server-aspnet-web-api\\PbiPaasWebApi\\Controllers\\ReportsController.cs:line 71\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}

Were you able to generate tokens using version 5.0.0 of the Jwt package? It was at 4.0.2.206221351 and I'm suspecting the new version is incompatible

mattmazzola commented 8 years ago

I was able to get it working by combing your changes to use V1 API's while still using v4.0.2 of the Jwt package. I pushed these in this commit: https://github.com/Azure-Samples/powerbi-dotnet-server-aspnet-web-api/commit/55b5bfee0b7bd3abe7a76dc9234c807a72c721d3

mschulz531 commented 8 years ago

Matt, Sorry I haven't got back to this yet, I was planning to, but work got in the way. As you have discovered, there is some issue with v5 of the Jwt package, so I went back to v4.x and everything started working again. Thanks for doing the commit. Regards, Mike

On Wed, Aug 10, 2016 at 6:39 PM, Matt Mazzola notifications@github.com wrote:

I was able to get it working by combing your changes to use V1 API's while still using v4.0.2 of the Jwt package. I pushed these in this commit: 55b5bfe https://github.com/Azure-Samples/powerbi-dotnet-server-aspnet-web-api/commit/55b5bfee0b7bd3abe7a76dc9234c807a72c721d3

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Azure-Samples/powerbi-dotnet-server-aspnet-web-api/pull/2#issuecomment-239037336, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ7PPsGiRv3OaSTr0V-013aw7IgmOSadks5qemFMgaJpZM4JaykE .