Open daniel-seitz opened 2 years ago
@daniel-seitz - Did you find any solution to this?
@jaspreet1234567 yes, I wrote it myself. Take the time of expiry, I subtracted some minutes and request a new token then.
@daniel-seitz - Thanks for the info. I did the same but unbale to update the token in power-bi. How you update the new token with i-frame?
Ok, the whole process:
<powerbi-report
[embedConfig]="embedConfig"
[cssClassName]="'embedded-report'"
[phasedEmbedding]="false"
[eventHandlers]="eventHandlers"
></powerbi-report>
we hook into the rendered event:
get eventHandlers(): Map<string, EventHandler|null> {
return new Map([
['loaded', () => { ... }],
['pageChanged', (event: any) => { ... }],
['rendered', () => {
// HERE
}],
['error', (error: any) => { ... }]
])
Of course, instead of HERE
we call a function (that also gets called on the document:visibilitychanged event - when the tab is switched to and showing the report again.)
the logic is somehow like this:
Thats it.
Regarding your answer: You just need to replace the embedConfig with a new reference, not just update the accessToken property.
Thanks @daniel-seitz for the quick response and solution. Will try it and let you know. I think it will work.
Hi @daniel-seitz - Regarding your text: You just need to replace the embedConfig with a new reference, not just update the accessToken property.
Do we just need to update the access token property like: embedConfig.accessToken with new token OR need to create new embedConfig object and assign again to Input property like: [embedConfig]="embedConfig"
According to the docs we have to implement functionality to refresh the token automatically.
Is there / do you / could you have any plans to implement this functionality on this package?
Would be nice if we could subscribe to a method in this package instead of everyone writing their own manual solution.