@everlution/citadel-web-sdk
v0.5.0
Published
Citadel web SDK.
Downloads
63
Readme
Citadel Web SDK
Usage
import { CitadelClient } from '@everlution/citadel-web-sdk';
export const sso = new CitadelClient();
// Check is user is signed-in on the current domain/app:
if (!sso.hasLocalSession()) {
sso.signIn({ redirect: new URL(new URL(window.location.href).origin) });
} else {
console.log('already have session');
// you can sign out user by using
// sso.signOut()
}
Optionally you can use overlay for better UX like this:
import { CitadelClient, withOverlay } from '@everlution/citadel-web-sdk';
export const sso = new CitadelClient();
if (!sso.hasLocalSession()) {
withOverlay(sso.signIn({ redirect: new URL(new URL(window.location.href).origin) }));
} else {
console.log('already have session');
// you can sign out user by using
// withOverlay(sso.signOut());
}