修改了auth的bug

This commit is contained in:
lik 2020-11-27 16:40:08 +08:00
parent af71c348f4
commit 8d221222a9
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ AuthToken.prototype.getTokenData = async function (userToken) {
return tokenData; return tokenData;
}; };
AuthToken.prototype.checkTokenKoaRequest = async function (ctx, userkey, checkKey, next) { AuthToken.prototype.checkTokenKoaRequest = async function (ctx, next) {
let token = ctx.request.body.token let token = ctx.request.body.token
if (!token) token = ctx.header['authorization'] if (!token) token = ctx.header['authorization']
if (!token) token = token = ctx.header['token'] if (!token) token = token = ctx.header['token']
@ -81,7 +81,7 @@ AuthToken.prototype.checkTokenKoaRequest = async function (ctx, userkey, checkKe
return; return;
} }
let tokenData = await this.checkToken(token, userkey, checkKey); let tokenData = await this.checkToken(token, "");
if (!ret) { if (!ret) {
ctx.body = { ctx.body = {
result: 'fail', error: { code: 401, msg: 'User token error.' }, data: {} result: 'fail', error: { code: 401, msg: 'User token error.' }, data: {}

View File

@ -1,6 +1,6 @@
{ {
"name": "@ehason/auth", "name": "@ehason/auth",
"version": "1.3.0", "version": "1.3.1",
"description": "User auth lib", "description": "User auth lib",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {