Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
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 and registers it at start-up
through SystemBrowser.setProvider(OidcBrowserNative) – an instance
rather than a class name, because class names are obfuscated. 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 the same way –
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").
Methods
public abstract boolean isSupported() | true if this implementation is usable on the current device / OS version. |
public abstract 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. |
Method details
isSupported
public abstract 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
public abstract 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.