oneid-sdk v1.0.13
OneID SDK for JavaScript
For more information on OneID and its features, see the documentation.
🚀 Getting Started
The easiest way to integrate the OneID SDK into your JavaScript project is through the npm module. However, if you want to use a pre-compiled file, you can fetch it from unpkg. The development version is available at https://unpkg.com/browse/oneid-sdk@1.0.13/src/index.ts.
📲 Installation
You can easily install this package from NPM by running the following command in your terrminal:
$ npm install --save oneid-sdk
Or including the script in your HTML file via UNPKG:
<script src="https://unpkg.com/browse/oneid-sdk@1.0.13/src/index.ts"></script>
To use the npm modules for a browser based application, include it as you normally would:
// ES5 with module loaders/bundlers
const OneId = require('oneid-sdk');
// ES6 with module loaders/bundlers
import OneId from 'oneid-sdk'
🎁Features
The OneID JavaScript SDK currently offers the following features:
- Initialize SDK
- SSO/ Authentication
💻 Usage
OneId.start(options)
The initialization of OneId comes first. This is done at the highest level of your application to guarantee that the OneId SDk's global instance executes correctly.
To get the SDK started, use the start()
method as follows:
Example code:
const options = {
apiKey: "YOUR_API_KEY",
siteDomain: "YOUR_SITE_DOMAIN starting with http:// or https://"
}
window.addEventListener('load', () => {
OneId.start(options)
}
options | Description |
---|---|
apiKey | This is a private key assigned to each developer's account. Generate one here. |
siteDomain | This a url of the same-origin with your application starting with http:// or https:// |
OneId.handleAuth(options)
Using the SDK for user authentication is really simple. When you call the handleAuth()
method, a window will pop up which processes the authentication and then returns you to the application.
Example code:
btn.addEventListener('click', (e) => {
e.preventDefault()
OneId.handleAuth().then((data) => {
console.log(data);
}).catch(error => {
console.log(error);
})
})
🤝Support
If you have any problems when using this SDK, please file a bug report on this repository by creating an issue and the development team will look into it as soon as possible.
⌨ Typescript
This library offers first-class Typescript support.
✔ License
MIT © wolzcodelife.web.app . GitHub @wolz-codelife