4.0.0 • Published 4 years ago

wkwkwk-js v4.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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.

4.0.0

4 years ago

3.0.0

4 years ago

1.5.0

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago