# watson-token

> Ibm watson token generator

Latest version **0.0.8** (published 2020-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install watson-token
pnpm add watson-token
yarn add watson-token
bun add watson-token
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2020-11-06 |
| First published | 2020-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | saifulriza |
| Maintainers | saifulriza |
| Keywords | ibm, watson, ibm-watson, toke, token-generator, generator, speech-to-text |

## Links

- npm: https://www.npmjs.com/package/watson-token
- Repository: https://github.com/saifulriza/watson-token
- Homepage: https://github.com/saifulriza/watson-token#readme
- Issues: https://github.com/saifulriza/watson-token/issues
- npm.io page: https://npm.io/package/watson-token

## Recent versions

- 0.0.8 (latest) — 2020-11-06
- 0.0.7 — 2020-11-04
- 0.0.6 — 2020-11-04
- 0.0.5 — 2020-11-04
- 0.0.4 — 2020-11-03
- 0.0.3 — 2020-11-03
- 0.0.2 — 2020-11-03

## README

## Warning

Don't use this package for production. your apikey will exposed when program generating token
=======
## IBM Watson Token Generator

![Publish package](https://github.com/saifulriza/watson-token/workflows/Publish%20package/badge.svg?branch=main)


## Installation

```
npm i watson-token
```

## How to use

```
generateToken(
    DOMAIN,
    PATH,
    PORT,
    APIKEY,
    CALLBACK
  );
```

| name     | type     |
| -------- | -------- |
| DOMAIN   | string   |
| PATH     | string   |
| PORT     | number   |
| APIKEY   | string   |
| CALLBACK | function |

## 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!](https://github.com/chimurai/http-proxy-middleware#readme)

---
_Source: https://npm.io/package/watson-token · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
