Skip to content

Instantly share code, notes, and snippets.

View krishnaanaril's full-sized avatar
🎯
Focusing

Krishna Mohan krishnaanaril

🎯
Focusing
View GitHub Profile
@krishnaanaril
krishnaanaril / TileEmbedConfig.cs
Last active October 5, 2018 08:09
Class for storing the token details of Power BI tiles. It inherits the 'EmbedConfig' class
public class TileEmbedConfig : EmbedConfig
{
public string dashboardId { get; set; }
}
@krishnaanaril
krishnaanaril / ValuesController.cs
Last active October 14, 2018 19:11
ASP.Net Web API controller that is used to generate Power BI embed tokens for Dashboard, Reports and Tiles
public class ValuesController : ApiController
{
private static readonly string Username = ConfigurationManager.AppSettings["pbiUsername"];
private static readonly string Password = ConfigurationManager.AppSettings["pbiPassword"];
private static readonly string AuthorityUrl = ConfigurationManager.AppSettings["authorityUrl"];
private static readonly string ResourceUrl = ConfigurationManager.AppSettings["resourceUrl"];
private static readonly string ApplicationId = ConfigurationManager.AppSettings["ApplicationId"];
private static readonly string ApiUrl = ConfigurationManager.AppSettings["apiUrl"];
private static readonly string WorkspaceId = ConfigurationManager.AppSettings["workspaceId"];
private static readonly string ReportId = ConfigurationManager.AppSettings["reportId"];
@krishnaanaril
krishnaanaril / EmbedConfig.cs
Created October 5, 2018 06:39
EmbedConfig is the class that is used to store the details of Power BI reports/dashboard that is to be embedded.
public class EmbedConfig
{
public string Id { get; set; }
public string EmbedUrl { get; set; }
public EmbedToken EmbedToken { get; set; }
public int MinutesToExpiration
{
@krishnaanaril
krishnaanaril / auth-guard.service.ts
Created June 10, 2018 05:35
Example for auth-guard in Angular 6
canActivate() {
if ( this.authService.isLoggedIn() ) {
return true;
}
this.router.navigate(['/']);
return false;
}