【文件属性】:
文件名称:node-apikey:api 密钥中间件
文件大小:7KB
文件格式:ZIP
更新时间:2021-07-09 19:39:30
JavaScript
简单的 API KEY auth 中间件
使用 API 密钥对请求进行身份验证的简单中间件,支持:
基本http://apikey:@example.com/验证: http://apikey:@example.com/
自定义标题
x-apikey
x-api-key
apikey
查询字符串
api-key
apikey
api
目前仅适用于 Express。
例子
快速服务器:
var app = require ( 'express' ) ( ) ;
app . use ( require ( 'apikey' ) ( auth , 'my realm' ) ) ;
function auth ( key , fn ) {
if ( 'test' === key )
fn ( null , { id : '1' , name : 'John Dor
【文件预览】:
node-apikey-master
----.travis.yml(38B)
----index.js(1KB)
----package.json(621B)
----test()
--------index.js(1KB)
--------koa.js(2KB)
----LICENSE(1KB)
----example.js(304B)
----.gitignore(13B)
----lib()
--------basicauth.js(814B)
--------findapi.js(516B)
----koa.js(929B)
----README.md(2KB)