Interface OidcBrowserNative


public interface OidcBrowserNative

Service-provider interface that SystemBrowser uses to dispatch a sign-in flow through the OS's hardened sign-in surface (ASWebAuthenticationSession on iOS, androidx.browser.customtabs / Credential Manager on Android).

The platform port supplies an implementation named com.codename1.io.oidc.OidcBrowserNativeImpl; SystemBrowser loads it via Class.forName at first use. Cn1lib authors who want to plug in their own implementation (for example, one backed by a NativeInterface so a 3rd-party SDK can drive the browser) can declare a subtype and register it with

invalid reference
SystemBrowser#setNative(OidcBrowserNative)
-- there is

no need to extend NativeInterface from this interface itself.

redirectScheme is the scheme half of the registered redirect URI (e.g. the "com.example.app" part of "com.example.app:/oauth2redirect").

Since:
7.0.245
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    true if this implementation is usable on the current device / OS version.
    startAuthorization(String authUrl, String redirectScheme)
    Starts the OS sign-in sheet for authUrl and resolves when the user is redirected to a URL matching redirectScheme.
  • Method Details

    • isSupported

      boolean isSupported()
      true if this implementation is usable on the current device / OS version. The default fallback (SystemBrowser's in-app BrowserWindow) takes over when this returns false, so a port that has a class on the file system but cannot satisfy the runtime requirements (e.g. iOS 11 lacks ASWebAuthenticationSession) should report false and the call will degrade gracefully.
    • startAuthorization

      String startAuthorization(String authUrl, String redirectScheme)

      Starts the OS sign-in sheet for authUrl and resolves when the user is redirected to a URL matching redirectScheme. The return value is the full redirect URL (including query / fragment), or null if the user cancelled.

      Implementations are expected to be blocking: the caller is on a worker thread and waits for the result.