capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!
MIT License
231 stars 113 forks source link

Call back function is not returning the value #223

Open manoj1976 opened 1 year ago

manoj1976 commented 1 year ago

Description

Capacitor version:

Run npx cap doctor:

Latest Dependencies:

  @capacitor/cli: 4.6.1
  @capacitor/core: 4.6.1
  @capacitor/android: 4.6.1
  @capacitor/ios: 4.6.1

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 4.6.1
  @capacitor/core: 4.6.1
  @capacitor/android: 4.6.1

Library version:

OAuth Provider:

Your Plugin Configuration

{
    getLogoutOptions(): OAuth2AuthenticateOptions {
    return {
      //appId: environment.oauthAppId.azureBc2.appId,
      appId: environment.appid,
      authorizationBaseUrl: 'https://login.microsoftonline.com/XXX/oauth2/v2.0/authorize',
      scope: "https://graph.microsoft.com/User.Read", // See Azure Portal -> API permission
      accessTokenEndpoint: 'https://login.microsoftonline.com/XXX/oauth2/v2.0/token',
      resourceUrl: "https://graph.microsoft.com/v1.0/me/",
      responseType: "code",
      pkceEnabled: true,
      logsEnabled: true,
      web: {
        redirectUrl: environment.redirectUrl,
        windowOptions: "height=600,left=0,top=0",
      },
      android: {
        redirectUrl: "msauth://XXX"
      },
      ios: {
        pkceEnabled: true, // workaround for bug #111
        redirectUrl: "msauth.{package-name}://auth"
      }
    };
  }
}

Affected Platform(s):

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ie.prostrategy.oauthtest">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
        android:name="ie.prostrategy.oauthtest.MainActivity"
        android:label="@string/title_activity_main"
        android:theme="@style/AppTheme.NoActionBarLaunch"
        android:launchMode="singleTask"
        android:exported="true">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter>
            <!--manoj-->
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/custom_url_scheme" android:host="@string/custom_host" />

            <data android:scheme="@string/azure_b2c_scheme" android:host="@string/package_name" android:path="@string/azure_b2c_signature_hash" />

        </intent-filter>

    </activity>

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths"></meta-data>
    </provider>
    <!--manoj-->
     <activity
        android:name="com.microsoft.identity.client.BrowserTabActivity"
        android:exported="true">
        <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="@string/azure_b2c_scheme" android:host="@string/package_name" android:path="@string/azure_b2c_signature_hash" />
             <!--<data android:scheme="@string/custom_url_scheme" android:host="oauth" />-->
             <data android:scheme="@string/custom_url_scheme" android:host="@string/custom_host" />
            <data android:scheme="msauth"
                android:host="ie.prostrategy.oauthtest"
                android:path="/anTrw8Xj5bDQyFFO49XzoeQLN9c=" />
        </intent-filter>
    </activity>
</application>

<!-- Permissions -->

<uses-permission android:name="android.permission.INTERNET" />