# dacong-koa-verifytoken

> ```shell npm install dacong-koa-verifytoken@latest ```

Latest version **1.0.1** (published 2023-12-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install dacong-koa-verifytoken
pnpm add dacong-koa-verifytoken
yarn add dacong-koa-verifytoken
bun add dacong-koa-verifytoken
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-12-01 |
| First published | 2023-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dacong.wu |
| Keywords | token, verifytoken, koa-token, verify-jwt |

## Links

- npm: https://www.npmjs.com/package/dacong-koa-verifytoken
- npm.io page: https://npm.io/package/dacong-koa-verifytoken

## Dependencies (4)

- [log4js](https://npm.io/package/log4js.md) ^6.9.1
- [koa-router](https://npm.io/package/koa-router.md) ^12.0.0
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^9.0.2
- [ua-parser-js](https://npm.io/package/ua-parser-js.md) ^1.0.36

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-12-01
- 1.0.0 — 2023-09-21

## README

### 安装

```shell
npm install dacong-koa-verifytoken@latest
```

### 使用

```javascript
/* 🌰 /router.js
secret:token秘钥 default:'secret'
excludedPaths:需要排除验证的路由host完整地址 🌰 https://test.cn/api/8888 default:[]
NODE_ENV:Node的环境，production环境才会执行验证，方便本地开发 default:'production'
*/
const router = require('koa-router')()
const { verifyToken } = require('dacong-koa-verifytoken')

router.use(verifytoken({secret, excludedPaths, NODE_ENV}))
router.use('/other') // 其它需要验证的路由
module.exports = router
```

### 注意事项

1. 这是 `Koa` 的插件
2. `NODE_ENV` 为 `production` 时，才会生效
3. `excludedPaths` 为一个 `host` 路径数组

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