fluttercommunity / fluttercommunity/flutter_downloader

Unable to download private files (e.g.: files which are accessed through login)

Open
#881 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
940
Forks
561
Avg merge
1h 18m
Merged PRs (30d)
1

Description

**Unable to download private files (e.g.: files which are accessed through login)**

I am use inappWebView plugin for my app. When I try to download any file (for example, book from a website which requires login to download books) i get success in the debug console but the downloaded file is some html everytime.
**Screenshots**

![image](https://github.com/fluttercommunity/flutter_downloader/assets/111647708/4b4e832f-ffa8-4883-91ef-fb831b109c3c)

![image](https://github.com/fluttercommunity/flutter_downloader/assets/111647708/0b2ddade-de40-4b4c-951d-ac6dfe38980a)

**Code**
```
Future downloadFile(String url,
[String? filename]) async {
var hasStoragePermission = await Permission.storage.isGranted;
if (!hasStoragePermission) {
final status = await Permission.storage.request();
hasStoragePermission = status.isGranted;
}
if (kDebugMode) {
print('downloadFile: $url');
}
if (hasStoragePermission) {
await FlutterDownloader.enqueue(
url: url,
headers: {},
savedDir: (await getTemporaryDirectory()).path,
saveInPublicStorage: true,
fileName: filename);
}
}
```
- OS: Andriod
- Version: 14

**Device information:**

- Device: pixel 6 pro
- OS: android
- plugin version ^1.9.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the FlutterDownloader.enqueue call shown in the report, especially its empty headers, and investigate how authenticated downloads are handled on Android 14. Reproduce the case with a login-protected URL and verify that the downloaded result is the requested file rather than an HTML login response.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.