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) {
|
||||
// Log the URL being used for debugging
|
||||
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(
|
||||
state.viewUrl.toString(),
|
||||
headers: {
|
||||
'Authorization': 'Bearer ${state.token}',
|
||||
},
|
||||
onDocumentLoadFailed: (details) {
|
||||
print('PDF load failed: ${details.error}');
|
||||
print('Description: ${details.description}');
|
||||
|
||||
Reference in New Issue
Block a user