Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17927

Display report using powerbi-client and react (typescript)

$
0
0

Hello. 

I have been working on a .NET Core application with React.

Server side works fine (tokens generated work on the powerbi javascript demo)

 

 

Tokens from PowerBI Javascript Demo  doesnt work on the client side (react component). Neither the tokens generated from my server.

 

GET https://wabi-north-europe-redirect.analysis.windows.net/metadata/cluster 403 (Forbidden)

 

I have recreated a small application. Here is the component:

import * as React from 'react';
import * as pbi from 'powerbi-client';

export default class App extends React.Component<{}, {}> {
    private powerbi: pbi.service.Service;
    private embedContainer: HTMLDivElement;
    constructor(props: {}) {
        super(props);
        this.powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
    }
    public render() {
        return (<div className="embedContainer" powerbi-type="report" style={{'height' : '600px', 'width' : '100%'}} ref={(div) => { if (div) {this.embedContainer = div; }}}/>
        );
    }
    componentDidMount() {
        // console.log(this.props);
        let config = {
            'accessToken': '',
            'embedUrl':  '',
            'id': ''
        };
        console.log(config);
        this.powerbi.embed(this.embedContainer, config);
    }
}

 

Would love to share a repo with the code, but i think is not allowed (my posts are being deleted without reason/ private message)

 


Viewing all articles
Browse latest Browse all 17927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>