79153003

Date: 2024-11-03 15:14:10
Score: 0.5
Natty:
Report link

The correct way to initialize the pnpjs graph is to use GraphBrowser() instead DefaultInit().

this.graph = graphfi().using(GraphBrowser(), i => (i.on.auth.replace(async (s, c) => {
        const l = await this.authService.getGraphApiToken({
            authority: this.authority
        });
        if (!l) {
            console.error("No token");
        }
        return c.headers = {
            ...c.headers,
            Authorization: `Bearer ${l.accessToken}`
        },
        [s, c]
    }), i));
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Frank Link