LinkHub Node.js SDK
raw JSON → 1.8.2 verified Sat Apr 25 auth: no javascript
Node.js SDK for LinkHub authentication modules, version 1.8.2, released infrequently. Provides access to LinkHub's API for Korean electronic document and authentication services. Differentiator: official SDK for the LinkHub platform used in South Korea. Supports Node.js 0.10+.
Common errors
error Cannot find module 'linkhub' ↓
cause Package not installed or typo in package name.
fix
Run 'npm install linkhub' and verify package.json.
error LinkHub is not a constructor ↓
cause Incorrect import style, e.g., using named import instead of default.
fix
Use 'var LinkHub = require('linkhub');'.
Warnings
gotcha The SDK only supports CommonJS require, not ES modules. ↓
fix Use require() instead of import.
gotcha LinkHubType is not a separate export; it is a property of the main exported class. ↓
fix Access via require('linkhub').LinkHubType.
gotcha getToken callback expects (err, token) arguments; token is not returned in promise. ↓
fix Use callback pattern; there is no promise support.
Install
npm install linkhub yarn add linkhub pnpm add linkhub Imports
- LinkHub wrong
import LinkHub from 'linkhub';correctvar LinkHub = require('linkhub'); - linkhub wrong
const { LinkHub } = require('linkhub');correctvar linkhub = require('linkhub'); - LinkHubType wrong
import { LinkHubType } from 'linkhub';correctvar LinkHubType = require('linkhub').LinkHubType;
Quickstart
var LinkHub = require('linkhub');
var linkhub = new LinkHub({
linkID: process.env.LINK_ID || 'TESTER',
secretKey: process.env.SECRET_KEY || 'TESTER',
isTest: true
});
linkhub.getToken(30, function(err, token) {
if (err) console.error(err);
else console.log('Token:', token);
});