我正在开发一个UWP应用程序来显示我为用户创建的报告。但是,我似乎无法生成必要的安全令牌来验证报告,一旦我有它的嵌入URL。如何将Power BI报告集成到UWP C#应用程序
我试图将报告嵌入到webview内的iFrame中,以与web应用程序类似的样式显示它,但是,与webview相比,iFrame不会加载公共报告。
任何示例似乎都使用JwtSecurityToken,但它目前不与UWP应用程序兼容。
using System.IdentityModel.Tokens;
public string Generate(string accessKey = null)
{
if (string.IsNullOrWhiteSpace(this.AccessKey) && accessKey == null)
{
throw new ArgumentNullException(nameof(accessKey));
}
accessKey = accessKey ?? this.AccessKey;
var key = Encoding.UTF8.GetBytes(accessKey);
var signingCredentials = new SigningCredentials(new InMemorySymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature, SecurityAlgorithms.Sha256Digest);
var token = new JwtSecurityToken(this.Issuer, this.Audience, this.Claims, DateTime.UtcNow, this.Expiration, signingCredentials);
return new JwtSecurityTokenHandler().WriteToken(token);
}
有没有办法解决这个软件包没有使报告嵌入URL公开?或者也许是一种将它整合到应用程序中的方法?任何建议将不胜感激。
你是什么意思“的iFrame不加载公共报告相比,可以”的web视图?其实我可以在WebView中加载完整的报告,也许截图有助于理解您的问题 –
@ FranklinChen-MSFT如果我的WebView中有一个iFrame(这样做可以使用JavaScript PostMessage函数),那么无法加载公开可用的报告,而没有iFrame的WebView可以。 – sparksy64