capacitor-sso-webview
v0.0.8
Published
SSO WebView with URL intercept
Readme
capacitor-sso-webview
SSO WebView with URL intercept
Install
To use npm
npm install capacitor-sso-webviewTo use yarn
yarn add capacitor-sso-webviewSync native files
npx cap syncAPI
openSSO(...)close()addListener('ssoRedirect', ...)addListener('ssoCancelled', ...)removeAllListeners()- Interfaces
openSSO(...)
openSSO(options: SSOOpenOptions) => Promise<void>Buka WebView SSO. Navigasi ke redirectHost akan di-intercept dan DIBATALKAN sehingga authorization code tidak dikonsumsi.
| Param | Type |
| ------------- | --------------------------------------------------------- |
| options | SSOOpenOptions |
close()
close() => Promise<void>Tutup WebView secara manual
addListener('ssoRedirect', ...)
addListener(eventName: 'ssoRedirect', listenerFunc: (event: SSORedirectEvent) => void) => Promise<PluginListenerHandle>Fired saat redirect ter-intercept — code masih valid
| Param | Type |
| ------------------ | --------------------------------------------------------------------------------- |
| eventName | 'ssoRedirect' |
| listenerFunc | (event: SSORedirectEvent) => void |
Returns: Promise<PluginListenerHandle>
addListener('ssoCancelled', ...)
addListener(eventName: 'ssoCancelled', listenerFunc: () => void) => Promise<PluginListenerHandle>Fired saat user menutup WebView tanpa menyelesaikan login
| Param | Type |
| ------------------ | --------------------------- |
| eventName | 'ssoCancelled' |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Interfaces
SSOOpenOptions
| Prop | Type | Description |
| -------------------------- | ------------------- | ---------------------------------------------------------------- |
| url | string | URL SSO authorize endpoint |
| redirectHost | string | Host yang menandakan redirect, mis. "tdirectmbl.telkomsel.co.id" |
| redirectPathContains | string | Substring path redirect, mis. "mobilelogon" |
| title | string | Judul header WebView |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
SSORedirectEvent
| Prop | Type | Description |
| ----------- | ------------------- | ------------------------------------- |
| url | string | Full redirect URL yang ter-intercept |
| code | string | Authorization code (belum dikonsumsi) |
| state | string | State parameter dari OAuth flow |
