Search results

Include Authorization Token in Angular PDF Viewer component

26 Nov 2021 / 1 minute to read

The PDF Viewer library allows you to include the authorization token in the PDF viewer AJAX request using the properties of the ajaxRequest header available in AjaxRequestSettings, and it will be included in every AJAX request send from PDF Viewer.

The following steps are used to include the authorization token to the PDF viewer control.

Step 1: Follow the steps provided in the link to create simple PDF Viewer sample in Angular.

Step 2: Add the following code snippet to include the authorization token.

Copied to clipboard
<ejs-pdfviewer id="pdfViewer" [serviceUrl]='service' [documentPath]='document' [ajaxRequestSettings]="ajaxSetting"
Copied to clipboard
public ajaxSetting = {
    ajaxHeaders: [
        headerName: "Authorization",

        headerValue: "Bearer 64565dfgfdsjweiuvbiuyhiueygf"

    withCredentials: false

Find the Sample how to include authorization token