Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: id_token on Android fail #272

Open
EduarPer opened this issue Sep 18, 2024 · 1 comment
Open

Bug: id_token on Android fail #272

EduarPer opened this issue Sep 18, 2024 · 1 comment

Comments

@EduarPer
Copy link

Capacitor version:

Run npx cap doctor:

@capacitor/android: 6.1.2
@capacitor/cli: 6.1.0
@capacitor/core: 6.1.0

Library version:

  • 3.0.1

OAuth Provider:

  • Azure AD (B2C)

Your Plugin Configuration

{
    // Replace this with your plugin configuration
}

Affected Platform(s):

  • Android
    • Version/API Level: 9
    • Device Model: Samsung A20
    • Content of your AndroidManifest.xml
<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=".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>
        <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" />
      </intent-filter>

    </activity>

  <activity android:name="net.openid.appauth.RedirectUriReceiverActivity" 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/custom_url_scheme" android:host="@string/custom_host" />
    </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" />
      <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>
</application>

<!-- Permissions -->

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

### Current Behavior
When execute logout method on angular the parameter id_token is not available on Java class "GenericOAuth2Plugin" on Android Studio and the always enter on the if statement

String idToken = ConfigUtils.getParam(String.class, call.getData(), PARAM_ID_TOKEN);
          if (idToken == null) {
              this.disposeAuthService();
              this.discardAuthState();
              call.resolve();
              return;
          }


@zolakt
Copy link

zolakt commented Oct 17, 2024

There is something definitely missing with this logout support.

You can get around the id_token issue by adding it manually to the config object, but then you will hit another issue where it doesn't parse the logoutUrl.

It has been reported here #233 (comment) over a year ago. So I wonder if this lib is even maintained anymore?

Btw. for web and Android, this is the only logout approach that worked for me #97 (comment). Haven't tested iOS yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants