@teammaestro/capacitor-single-signon
v2.0.0
Published
This plugin is designed to streamline the single signon process between android and ios
Downloads
14
Readme
Capacitor Single SignOn
Installation
npm i @teammaestro/capacitor-single-signon
Usage
iOS
This supports iOS SDK version 11+ (Important). The build will fail on SDK version 10 and below. Make sure to set your custom scheme in the Info.plist
Android
Add the following to your Android.manifest
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace">
<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="yourCustomScheme"/>
</intent-filter>
</activity>
You will need to comment the default 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/custom_url_scheme" />
</intent-filter>
import { SingleSignOn } from '@teammaestro/capacitor-single-signon';
const sso = new SingleSignOn();
sso
.authenticate({ url: 'someUrl', customScheme: 'customSchemeIfNeeded' })
.then(response => {
// this response will contain your completion URL with all your authorization keys used from the oauth callback
})
.catch(err => {});
Api
| Method | Default | Type | Description |
| ---------------------------------------------------- | ------- | ------------------------- | --------------------------- |
| authenticate(options: { url: string, customScheme: string }) | | Promise<{ url: string }>
| Can be used for sso/oauth |