PDF Web Viewer
    Preparing search index...

    Interface IOneDriveConfig

    OneDrive (Microsoft Graph) integration configuration.

    When supplied, the viewer shows a "OneDrive" card on the empty ("home") screen with a Connect action. Once the end user connects, the card lists their recent OneDrive PDFs and lets them browse folders; clicking a file opens it in the viewer. The library performs the OAuth flow itself (via @azure/msal-browser) using the integrator-provided Azure app credentials and holds the resulting tokens — no host backend is required.

    The integrator must register a single-page-application (SPA) app in the Microsoft Entra / Azure portal, grant the delegated Microsoft Graph permissions matching IOneDriveConfig.scopes, and register IOneDriveConfig.redirectUri as an SPA redirect URI.

    interface IOneDriveConfig {
        authority?: string;
        clientId: string;
        isSaveAllowed?: AllowSaveGuard;
        redirectUri?: string;
        scopes?: string[];
    }
    Index

    Properties

    authority?: string

    Microsoft identity authority. Defaults to 'https://login.microsoftonline.com/common' (personal + work/school accounts). Override with a tenant-specific URL to restrict sign-in.

    clientId: string

    Azure "Application (client) ID" of the integrator's registered app. Required.

    isSaveAllowed?: AllowSaveGuard

    Optional guard for saving into OneDrive. The upload itself is performed by the library; this only decides whether a given document may be written to a given target. Omit it to allow every save. See AllowSaveGuard.

    redirectUri?: string

    OAuth redirect URI registered as an SPA redirect in the Azure app.

    Defaults to the redirect page shipped with the package: <origin>/pwv-onedrive/redirect.html (serve the package's public/ folder at your web root and register that exact URL as a Single-page application redirect URI — the match is exact, path included). Most web integrators should omit this and rely on the default.

    Override it only when the relay page is served from a non-root path, or for desktop shells: a cross-origin loopback URI (e.g. http://127.0.0.1:<port>/onedrive-callback) switches the connector into the external system-browser flow. Never point it at an app page — the URI is also loaded in a hidden iframe for silent token refresh, and booting an app there times MSAL out.

    scopes?: string[]

    Delegated Microsoft Graph scopes requested at connect time. Defaults to ['User.Read', 'Files.ReadWrite', 'offline_access'] — read-write, so saving back to OneDrive works out of the box. Configure Files.Read instead of Files.ReadWrite for a read-only integration: the drive then stops offering itself as a save target.