EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

net: ERR_UNKNOWN_URL_SCHEME with targetSdkVersion 30 #338

Open benmesza opened 2 years ago

benmesza commented 2 years ago

Bug Report

Problem

Use auth0 in Ionic cordova app, and when user sign in to app successfully cannot redirect to app because net: ERR_UNKNOWN_URL_SCHEME error. targetSdkVersion 29 was worked, but when upgrade to 30 get this error on Android 11 platform, but works on Android 10.

What is expected to happen?

Successfully redirect to app on Android 11

What does actually happen?

Get net: ERR_UNKNOWN_URL_SCHEME error.

Information

Command or Code

Auth0 integration

Environment, Platform, Device

Android 11

Version information

Cordova CLI: 10.0.0 Cordova platform: Cordova-Android 10.1.1 Frameworks: Ionic 5 with Angular 12.1.0

Checklist

Heimo001 commented 2 years ago

Hi benmesza,

we had the same issue, but thanks to the Ionic_AppAuth demos we solved it. https://github.com/wi3land/ionic-appauth/tree/master/demos/angular-cordova

Just update cordova-plugin-inappbrowser with this command: ionic cordova plugin add https://github.com/Onegini/cordova-plugin-inappbrowser.git

Best regards, Heimo

brassier commented 2 years ago

We're having a similar issue. @Heimo001 - I'm not quite following why your suggested fix would address this custom url scheme issue. Can you explain how the fix addresses the problem?

Heimo001 commented 2 years ago

I don't know what exactly is fixing this issue, because that repository is quite old, but it is due to an issue in the in app browser. You can test this with your system bwowser. When you type in your custom url scheme in chrome for example, you get refirected to your app.

So we compared our project with the ionic-appauth demos and that was the only difference and we adapted that to our project and it works now.

Just try it

brassier @.***> schrieb am Fr., 5. Nov. 2021, 20:45:

We're having a similar issue. @Heimo001 https://github.com/Heimo001 - I'm not quite following why your suggested fix would address this custom url scheme issue. Can you explain how the fix addresses the problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/338#issuecomment-962171900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW5CI5B5LWEXE34IDM4FA3UKQ65ZANCNFSM5FORJG5Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

alexneats commented 2 years ago

I checked this out.

The old repo works because it's doing a 'cordova.getActivity().startActivity(intent)', whereas the modern one tries to do a callbackContext.sendPluginResult(result) with the custom URL scheme, if the AllowedSchemes platform preference is specified. But even doing that doesn't get my app around the issue.

I stumbled onto this issue\pull request for cordova-plugin-safariviewcontroller v2.0.1: https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller/pull/180/files

Until that gets merged\released, adding this to my AndroidManifest.xml gets my app around the issue: `

`

Fourie-r commented 1 year ago

This is still an issue for us as well. Using: cordova-android@11.0.0 on device with Android 11 targeting SDK 31 works with the fix from @Heimo001

works on 'Android 9' with InAppBrowser v5.0.0. Trying to implement Auth0 with cordova and angular. Regards, Ivan