@sandbx_npm/ace-sdk-browser
v0.0.6
Published
SDK for ace authorisation system
Downloads
10
Readme
Ace authorisation SDK
Install
npm install @sandbx_npm/ace-sdk-browser
or
yarn add @sandbx_npm/ace-sdk-browser
Use cases
SDK uses umd module declaration. So you can use it such as node module system (commonjs), amd or globally in browser.
Examples:
es6 modules (typescript)
import { createClient, IAceClient } from '@sandbx_npm/ace-sdk-browser';
// ...
this.ace = createClient({
aceEndpoint: 'http://example.com',
ownAceEndpoint: 'http://example.com',
clientId: '<clientId>',
signInRedirectUri: 'http://example.com/user/login',
signUpRedirectUri: 'http://example.com/user/signUp'
});
CommonJs
const AceSdk = require('@sandbx_npm/ace-sdk-browser');
// ...
this.ace = AceSdk.createClient({
aceEndpoint: 'http://example.com',
ownAceEndpoint: 'http://example.com',
clientId: '<clientId>',
signInRedirectUri: 'http://example.com/user/login',
signUpRedirectUri: 'http://example.com/user/signUp'
});
global
<script src="/ace-sdk.js"></script>
<!-- ... -->
<script>
window.ace = AceSdk.createClient({
aceEndpoint: '<%=aceUrl %>',
ownAceEndpoint: location.origin,
clientId: '<%=clientId %>',
signInRedirectUri: location.origin + '/user/login',
signUpRedirectUri: location.origin + '/user/register',
localStorageKey: 'ace-tokens'
});
window.signUp = function() {
ace.signUp({ referrer: '<userValidEmail>' });
};
</script>
Develop
Use yarn run watch
or yarn build
command for development.
Tests
yarn test