oidc_android 1.0.1 copy "oidc_android: ^1.0.1" to clipboard
oidc_android: ^1.0.1 copied to clipboard

PlatformAndroid
unlisted

Android implementation of the oidc plugin

oidc_android #

openid certification

style: very good analysis

The Android implementation of package:oidc.

Usage #

This package is endorsed, which means you can simply use package:oidc normally. This package will be automatically included in your app when you do.

Redirect handling (native setup) #

This implementation opens the system browser via Chrome Custom Tabs and captures the redirect_uri when the browser redirects back to your app.

The plugin ships its own transparent redirect receiver (OidcRedirectActivity), so you do not add any <intent-filter> to your MainActivity, and you do not change its launchMode or taskAffinity. You only declare the scheme of your redirect_uri with a single manifest placeholder.

In android/app/build.gradle, inside android { defaultConfig { … } }:

android {
    defaultConfig {
        // ... existing config ...
        manifestPlaceholders += ['oidcRedirectScheme': 'com.example.app']
    }
}

That's the entire native setup. Use a reverse-DNS scheme you own (per RFC 8252 §7.1) and make your redirect_uri com.example.app://oauth2redirect.

If you previously used flutter_appauth, remove the old appAuthRedirectScheme placeholder and any redirect <intent-filter> you hand-added to MainActivity — they are no longer used.

For an https redirect you additionally need a verified Android App Link: host an assetlinks.json for your domain. Custom schemes need no such verification and are the simpler choice for most apps.

Note on process death #

The redirect is delivered in-memory to the running app. If the OS kills your app's process while the browser is open (rare, low-memory devices), the in-flight login cannot be resumed and the user must retry — the same limitation as comparable browser-based auth plugins.