No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 47dfa56 Feb 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android
ios/Plugin
src
.gitignore refactor: remove demo and flatten directories Feb 20, 2019
.npmignore
README.md
TeamHiveCapacitorSingleSignon.podspec 3.0.0 Feb 20, 2019
package-lock.json
package.json
rollup.config.js
tsconfig.json

README.md

Capacitor Single SignOn

npm npm

Installation

  • npm i @teamhive/capacitor-single-signon

Usage

iOS

This supports iOS SDK version 11+ (Important). The build will fail on SDK version 10 and below. Set the iOS minVersion in your capacitor.config.json to at least 11.0. Also, make sure to set your custom scheme in the Info.plist.

Android

Make sure you have the launchMode on the MainActivity set to singleTask:

<activity
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
    android:launchMode="singleTask"
    android:name="com.my.app"
    android:label="@string/title_activity_main"
    android:theme="@style/AppTheme.NoActionBarLaunch">
import '@teamhive/capacitor-single-signon';

import { Plugins } from '@capacitor/core';
const { SingleSignOn } = Plugins;

try {
    const response = await SingleSignOn.authenticate({
        url: 'someUrl',
        customScheme: 'customSchemeIfNeeded'
    });
    // this response will contain your completion URL with all your authorization keys used from the oauth callback
    console.log(response.url);
} catch (error) {
    console.error(error);
}

Api

Method Default Type Description
authenticate(options: { url: string, customScheme: string }) Promise<{ url: string }> Can be used for sso/oauth