aad_oauth icon indicating copy to clipboard operation
aad_oauth copied to clipboard

ERR_UNKNOWN_URL_SCHEME Error Appears After Successful Login

Open aveyselbozoglu opened this issue 1 year ago • 1 comments

In my pubspec.yaml i have, environment: sdk: ">=2.17.6 <3.13.7" , webview_flutter: ^3.0.4 , aad_oauth: ^0.4.1 versions , and in my code

static final Config config = Config(
   tenant: 'c4****ce',
   clientId: '2c****a14',
   scope: 'openid profile offline_access',
   redirectUri: 'msauth://com.myapp.mobile/w******Hw%3D',
   navigatorKey: navigatorKey,
   
 );
 final AadOAuth oauth = AadOAuth(config);
  
  await oauth.login();
  await oauth.getAccessToken();
  String? token = await oauth.getIdToken();
  

after this line of code
await oauth.login(); i can login to Azure Ad and then this error appears just a little time then my login is successful.

WebPage not available the webpage at msauth://......... net : ERR_UNKNOWN_URL_SCHEME

Couldn't fix it , any help very appriciated.

Here is my also AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.myapp.mobile">
    <uses-permission android:name="android.permission.INTERNET" />

<application
    android:icon="@mipmap/ic_launcher"
    android:label="Pho"
    android:usesCleartextTraffic="true">

     <activity
         android:name=".MainActivity"
         android:exported="true"
         android:launchMode="singleTop"
         android:theme="@style/LaunchTheme"
         android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
         android:hardwareAccelerated="true"
         android:windowSoftInputMode="adjustResize">
         <meta-data
           android:name="io.flutter.embedding.android.NormalTheme"
           android:resource="@style/NormalTheme" />

         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
         
         <intent-filter>
             <action android:name="android.intent.action.VIEW" />
         
             <category android:name="android.intent.category.DEFAULT" />
             <category android:name="android.intent.category.BROWSABLE" />
         
             <!-- msauth://{your_package_name} -->
             <data android:scheme="msauth"
                   android:host="com.myapp.mobile" />
         </intent-filter>
         
     </activity>
     
     <activity
         android:name="com.microsoft.identity.client.BrowserTabActivity">
         <intent-filter>
             <action android:name="android.intent.action.VIEW" />
             <category android:name="android.intent.category.DEFAULT" />
             <category android:name="android.intent.category.BROWSABLE" />
             <data android:scheme="msauth"
                 android:host="com.myapp.mobile" 
                 android:path="/w****Hw=" /> 
         </intent-filter>
     </activity>

     <!-- Don't delete the meta-data below.
          This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
     <meta-data
         android:name="flutterEmbedding"
         android:value="2" />
 
 </application>
 
</manifest>

aveyselbozoglu avatar Mar 14 '24 00:03 aveyselbozoglu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you still think this issue is needed, reopen it again.

github-actions[bot] avatar May 13 '24 02:05 github-actions[bot]

false

github-actions[bot] avatar Jun 13 '24 02:06 github-actions[bot]

Hello. I'm facing the same issue. I'm using aad_oauth: ^1.0.1 and webview_flutter: ^4.10.0 The error: could not be loaded because: net::ERR_UNKNOWN_URL_SCHEME

What can I do to get over this problem?

mvosantos avatar Dec 06 '24 13:12 mvosantos