wkwkwk-js v4.0.0
Bhinneka JS SDK
Javascript API Client Requires Node.js version 12.10 or higher.
Installation
Use the package manager to install Bhinneka JS SDK.
npm install bhinneka-js-sdk
Usage
Configuration
const config = {
strategy: GrantType,
tokenManager: {
read: 'auth',
create: 'newauth'
}
}
(CJS) CommonJS Module
const BmdSDK = require('bhinneka-js-sdk');
const SDKAuth = new BmdSDK.Authenticator(config)
const CookieAuth = SDKAuth.authenticate()
CookieAuth.then(response => {
console.log("response : ", response);
})
(ES) ES Module
import { Authenticator, GrantType } from 'bhinneka-js-sdk'
const SDKAuth = new Authenticator(config)
const CookieAuth = SDKAuth.authenticate()
CookieAuth.then(response => {
console.log("response : ", response);
})
Table of Contents
Authentication
This library is a wrapper for the User Service API
Strategy
User and Password
The API can be used to logged in, must add config strategy GrantType.PASSWORD
also add parameter username, password, device id, device login parameters
SDKAuth.authenticate(username, password, deviceId, deviceLogin)
method:
import { Authenticator, GrantType } from 'bhinneka-js-sdk'
const config = {
strategy: GrantType.PASSWORD
}
const SDKAuth = new Authenticator(config)
const CookieAuth = SDKAuth.authenticate(username, password, deviceId, deviceLogin)
CookieAuth.then(response => {
console.log("response : ", response)
})
Cookie
The API use for check logged in by cookie, must add config strategy GrantType.COOKIE
and use without parameter
SDKAuth.authenticate()
method:
import { Authenticator, GrantType } from 'bhinneka-js-sdk'
const config = {
strategy: GrantType.COOKIE
}
const SDKAuth = new Authenticator(config)
const CookieAuth = SDKAuth.authenticate()
CookieAuth.then(response => {
console.log("response : ", response)
})
Copyright Notice
Copyright © 2020 PT Bhinneka Mentari Dimensi.
NOTICE:
All Information contained herein is, and remains the property of PT Bhinneka Mentari Dimensi and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to PT Bhinneka Mentari Dimensi and its suppliers and maybe covered by Republic of Indonesia and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from PT Bhinneka Mentari Dimensi.