🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

watson-token

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watson-token

Ibm watson token generator

0.0.8
latest
Source
npm
Version published
Weekly downloads
4
-69.23%
Maintainers
1
Weekly downloads
 
Created
Source

Warning

Don't use this package for production. your apikey will exposed when program generating token

IBM Watson Token Generator

Publish package

Installation

npm i watson-token

How to use

generateToken(
    DOMAIN,
    PATH,
    PORT,
    APIKEY,
    CALLBACK
  );
nametype
DOMAINstring
PATHstring
PORTnumber
APIKEYstring
CALLBACKfunction

Example

import generateToken from "watson-token";
generateToken(
    "proxy-watson.herokuapp.com",                           // your domain proxy for bypassing cors
    "/identity/token",                                      // path of your proxy
    "80",                                                   // port of your proxy. default is 80
    "iGjNmBnh6rTw4P5EEk_5rYchhsQgtILxaJY0GAZk5Loo",         // your apiKey
    (response) => {
     console.log(response);                                 // get your generated key
    }
  );

Proxy

if you want to create your own proxy, you can just copy paste this short code :

const express = require("express");
const cors = require("cors");
const { createProxyMiddleware } = require("http-proxy-middleware");
const app = express();
const PORT = process.env.PORT || 3000;
app.use(cors());
app.use(
  "/identity/token",
  createProxyMiddleware({
    target: "https://identity-1.eu-central.iam.cloud.ibm.com",
    changeOrigin: true,
  })
);
app.listen(PORT);

Make sure you have installed express (npm install express), cors (npm install cors) and http-proxy-middleware (npm i http-proxy-middleware) to run this code.

for complete documentation of http-proxy-middleware you can find here!

Keywords

ibm

FAQs

Package last updated on 06 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts