Capacitor + Ionic4 : customurlscheme not redirecting to app from the browser app

Hello! I am working on a newly upgrader ionic 4 + capacitor app (I was using Ionic 3 and Cordova).

I am using the Cordova-plugin-customurlscheme plugin in order to redirect the user to the app after he/she logged in from a sso page in the browser (will eventually use an in app browser).

I set the custom url scheme to : http://localhost:3000. I did also set the URL_SCHEME variable when I added the plugin.

The url scheme also appears in the Info.plist file. However, when I type localhost:3000 in the browser on my phone, it does not redirect me to the app.

I was wondering if that behaviour was normal at all, or if I needed to show the login page in an in app browser in order to have the customer scheme working.

The plugin entry in the package.json is the following:

"cordova-plugin-customurlscheme": {
        "URL_SCHEME": "http://localhost:3000"

and here is the setup in my info.plist:


I am using the oidc-client nom package for authentication and I did set the redirect url to localhost:3000.

you are providing an url, not a custom scheme, a custom scheme looks like “mycustomurlscheme://”

Oh it is weird that it worked before the update. I will need to do some configuration in identityserver to add this scheme. So once the url scheme is set I can go to a browser on my phone, enter myapp:// and I will be redirected to my app?

yeah, if you have configured your app to open from myapp://, entering the url in a browser should open your app

1 Like

If I am using capacitor do I need to specify it in the capacitor config file? I was using cordova before. I specified the custom url scheme in the package.json.

In the Xcode project, I made sure that the custom url scheme was accuvapp:// and Safari still isn’t able to load anything saying that the address is invalid. When I run npx cap add ios I get a warning related to custom url scheme

I then went to the Info.plist and added
Screen Shot 2020-04-21 at 1.27.48 PM

My capacitor config file:

  "appId": "",
  "appName": "AccuV",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "www",
  "cordova": {
    "preferences": {
      "AndroidLaunchMode": "singleTask",
      "ScrollEnabled": "false",
      "android-minSdkVersion": "19",
      "android-compileSdkVersion": "28",
      "android-targetSdkVersion": "28",
      "BackupWebStorage": "none",
      "SplashMaintainAspectRatio": "true",
      "FadeSplashScreenDuration": "300",
      "SplashShowOnlyFirstTime": "false",
      "SplashScreen": "screen",
      "SplashScreenDelay": "30000",
      "AndroidPersistentFileLocation": "Compatibility",
      "windows-target-version": "10.0",
      "URL_SCHEME": "accuvapp://"

Screen Shot 2020-04-21 at 1.33.57 PM
Am I missing something?

I got it! I wrote accuvapp:// with the :// !!! I needed to only write accuvapp! Thanks!

Hey how did u get it work ?

we are using Keycloak SSO and after i clicked on Login it should redirect to the app but it just do nothing… if i click again then its open an empty page cause i already logged in but i doesnt get redirected to the app.

my url_scheme is correct

in android is works