EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

net: ERR_UNKNOWN_URL_SCHEME with targetSdkVersion 30

benmesza opened this issue · comments

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

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
commented

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

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?

commented

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:
<queries> <intent> <action android:name="android.support.customtabs.action.CustomTabsService" /> </intent> </queries>

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