Reputation: 41129
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.
Upvotes: 9
Views: 5993
Reputation: 10529
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.
Follow this guide to install mkcert. Run mkcert -install
on the terminal to create a new local certificate authority using mkcert. Then run mkcert localhost
- this makes all localhost address trusted. Other samples are demonstrated in here.
As for this feature to be directly baked into the Flutter plugin, there's an active feature request on GitHub that you can track.
Upvotes: 0