Open IchordeDionysos opened 1 week ago
We've experimented also with a potential solution and this change would fix the issue:
Note: We have to be careful and consider potential security implications of such a change!
We should just take this PR – great idea!
I also can see the issue when using a self-signed certification localhost (https://github.com/huycozy/local-server-self-signed-nodejs) with the given Flutter sample code above. Image is not displayed. On browser console, there is an error like this:
Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID
Steps to reproduce
Expected results
The
/authenticated_image
request succeeds as it can validate the passed Cookies.Actual results
The cookies are not sent as part of the
/authenticated_image
request, and thus, authenticating failed.Code sample
Full runnable example: image_cookies.zip
Code sample
`main.dart`: ```dart import 'package:dio/browser.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Flutter Web Cookie Authentication'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override StateLogs
No response
Flutter Doctor output
Doctor output
```console Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel [user-branch], 3.23.0-13.0.pre.243, on macOS 14.3 23D56 darwin-arm64, locale en-DE) ! Flutter version 3.23.0-13.0.pre.243 on channel [user-branch] at /Users/dennis/develop/bin/flutter Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Upstream repository https://github.com/simpleclub-extended/flutter.git is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to https://github.com/simpleclub-extended/flutter.git to dismiss this error. [!] Android toolchain - develop for Android devices (Android SDK version 33.0.1) ✗ cmdline-tools component is missing Run `path/to/sdkmanager --install "cmdline-tools;latest"` See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] IntelliJ IDEA Ultimate Edition (version 2024.1) [✓] VS Code (version 1.88.1) [✓] Connected device (3 available) [✓] Network resources ! Doctor found issues in 2 categories. ``` Note: I'm on a custom branch as I've experimented with a fix. At the time of testing, no changes were made to Flutter. :)