Matterway
    Preparing search index...

    Function getMsGraphClientUserAuth

    • Authenticates a user with SharePoint using MSAL and Puppeteer and returns a SharePoint Graph API client.

      Parameters

      • ctx: Context

        SDK context.

      • props: {
            clientId: string;
            tenantId: string;
            localPort: number;
            scopes: string[];
            resourceUrl: string;
        }
        • clientId: string

          The Azure AD application client ID.

        • tenantId: string

          The Azure AD tenant ID.

        • localPort: number

          The local port used for the authentication redirect.

        • scopes: string[]

          The authentication scopes required for access.

        • resourceUrl: string

          A SharePoint resource URL to navigate to before authentication.

      Returns Promise<Client>

      A promise that resolves to an authenticated SharePoint client instance.

      const client = await getMsGraphClientUserAuth(ctx, {
      clientId: 'your-client-id',
      tenantId: 'your-tenant-id',
      localPort: 3000,
      scopes: ['Mail.Send', 'Mail.ReadWrite'],
      resourceUrl: ['https://outlook.office.com/mail/']
      });