How to run Flutter application on web with an https address and not http:

Viewed 3472

I'm trying to port an App I made with Flutter for Android and iOS and run it on web as well. Due to the fact that I use Google and Facebook login frameworks there is a need to use an 'https' address even that the original url is localhost. I'm using the Web Server run option which runs the app in the build in web server inside Android Studio.

I'm running the web app currently using the following command from the command line:

flutter run -d web-server --web-hostname=`hostname` --web-port=8080 --profile -v

And using the port that I specified in the Google API Console, but I'm still failing to authenticate in one of the platforms due to the fact that I'm not using an 'https' and the connection is not secured.

Has any one encountered this issue and know how this can be resolved? I would greatly appreciate any help you can provide on the matter.

1 Answers

You can use mkcert to create a certificate and sign it with a Certificate Authority (CA) that is trusted locally by your device and browser.

As for this feature to be directly baked into the Flutter plugin, there's an active feature request on GitHub that you can track.

Related