Capacitor 3: Run livereload with with ssl

I need to run the capacitor live reload with ssl, because the library auth0-spa needs to be executed on a secure origin. So I use this command to run livereload:

ionic cap run -l --external --ssl

To make this work, I need to add the code from user Badisi in this github issue to MainActivity.java. Otherwise, the self signed certificate is not accepted.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
        // Additional plugins you've installed go here
        // Ex: add(TotallyAwesomePlugin.class);
    }});

    if (BuildConfig.DEBUG) {
        this.bridge.getWebView().setWebViewClient(new BridgeWebViewClient(this.bridge) {
            @Override
            public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
                handler.proceed();
            }
        });
    }
}

This works, but it skips Capacitor 3 plugin auto detection.

How can I modify this code to have working Capacitor 3 plugin auto detection?
Do you plan to implement support for --ssl flag in livereload mode? Would be great. In some cases, it is needed.

I have the same issue!

Any solution soon?..

Did you ever find a resolution to running the auth0-spa on a livereload server?

@jcesarmobile made a plugin just for that.

But make sure to uninstall it before going to production!

Great, thank you! Still an ugly solution, but much better than hacking files in the node_modules folder :slightly_smiling_face: - At least you see it in git changelog of package.json

Finally found a good solution for that. After struggling with self signed certficates I found ngrok. With ngrok you can proxy your localhost with a public ssl encrypted domain.

Just install ngrok with apt-get or brew, and start a tunnel with a command like ngrok http localhost:8100. You then get a public domain which you can use for livereload like ionic cap run android --livereload-url https://mysubdomain.ngrok.dev.

ngrok generates a random domain in the free version. You can subscribe from 10$/Month to use your own domain.

It`s a great tool! Finally livereload with Auth0 in my project.

@admins1 : I think this solution should be add to those github tickets:

I can imagine that a lot of people who need https in their Ionic / Capacitor app struggle with that.