apps/docs/content/guides/integrate/authenticated-mongodb-charts.mdx
This integration guide shows how you can embed authenticated MongoDB Charts in your web application using ZITADEL as authentication provider.
Before you can embed an authenticated chart in your application, you have to do a few setup steps in ZITADEL Console. You will need to provide some information about your app. We recommend creating a new app to start from scratch.
Your application settings should now look similar to this:
Configure ZITADEL as your Custom JWT Provider following the MongoDB docs .
Configure the following values:
Your settings should look similar to this:
Embed a chart into your application now, following the corresponding MongoDB docs.
If you've done the Angular Quickstart, your code could look something like this:
<div id="chart"></div>
/* chart.component.css */
div#chart {
height: 500px;
}
// chart.component.ts
@Component({
selector: 'app-chart',
templateUrl: './chart.component.html',
styleUrls: ['./chart.component.css']
})
export class ChartComponent implements OnInit {
constructor(private auth: AuthenticationService) { }
ngOnInit(): void {
this.renderChart().catch(e => window.alert(e.message));
}
async renderChart() {
const sdk = new ChartsEmbedSDK({
baseUrl: "<YOUR CHARTS BASE URL HERE>",
getUserToken: () => {
return this.auth.getAccessToken()
},
});
const chart = sdk.createChart({
chartId: "<YOUR CHART ID HERE>"
});
await chart.render(<HTMLElement>document.getElementById("chart"));
}
}