Add Authorization header to modal PDF viewer
This commit is contained in:
@@ -180,9 +180,12 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
|
|||||||
if (state.caps.isPdf) {
|
if (state.caps.isPdf) {
|
||||||
// Log the URL being used for debugging
|
// Log the URL being used for debugging
|
||||||
print('Loading PDF from: ${state.viewUrl}');
|
print('Loading PDF from: ${state.viewUrl}');
|
||||||
// Token is passed via Authorization header in SessionBloc context
|
// Pass token via Authorization header - SfPdfViewer supports headers parameter
|
||||||
return SfPdfViewer.network(
|
return SfPdfViewer.network(
|
||||||
state.viewUrl.toString(),
|
state.viewUrl.toString(),
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ${state.token}',
|
||||||
|
},
|
||||||
onDocumentLoadFailed: (details) {
|
onDocumentLoadFailed: (details) {
|
||||||
print('PDF load failed: ${details.error}');
|
print('PDF load failed: ${details.error}');
|
||||||
print('Description: ${details.description}');
|
print('Description: ${details.description}');
|
||||||
|
|||||||
Reference in New Issue
Block a user