Authorization token in React Pdfviewer component
28 Sep 20231 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.
Here is an example of how you can use the AjaxRequestSettings property to include the authorization token to the PDF viewer control:
<PdfViewerComponent
id="container"
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
serviceUrl="https://services.syncfusion.com/react/production/api/pdfviewer"
style={{ height: '640px' }}
ajaxRequestSettings={{
ajaxHeaders: [
{
headerName: 'Authorization',
headerValue: 'Bearerabcdefghijklmnopqrstuvwxyz',
},
],
withCredentials: false,
}}>
<Inject services={[ Toolbar, Magnification, Navigation, Annotation, LinkAnnotation, BookmarkView,
ThumbnailView, Print, TextSelection, TextSearch, FormDesigner, FormFields ]} />
</PdfViewerComponent>
Find the sample how to include authorization token