Skip to content


This library provides a thin wrapper around the msal library to make it easy to integrate MSAL authentication in the browser.

You will first need to install the package:

npm install @pnp/msaljsclient --save

The configuration and authParams

import { spfi, SPBrowser } from "@pnp/sp";
import { MSAL } from "@pnp/msaljsclient";
import "@pnp/sp/webs";

const configuation = {
    auth: {
        authority: "",
        clientId: "{client id}",

const authParams = {
    scopes: ["https://{tenant}"],

const sp = spfi("").using(SPBrowser(), MSAL(configuration, authParams));

const webData = await sp.web();

Please see more scenarios in the authentication article.