How can koa be verified using token jwt?

set to use token and url, that does not require verification to successfully return to the front end token using login

app.js
const jwtKoa = require("koa-jwt");
app.use(jwtKoa({secret}).unless({
    path: [/\/adduser/, /\/login/] //jwt
}))

but without path validation, the following function does not go at all, as I have seen in other articles. I don"t know where the problem

router.js
const routers = router
    .post("/product/list", user.list)

servse.js
const user = {
    async list (ctx) {
        console.log(ctx.headers.token, "ccccccccccc")
    }
}
May.22,2021

requires an Authorization:Bearer [token] field attached to the request header.


seems to be the order of app.use (). Do you call this in app.js? then try

.
app.use(jwtKoa({secret}).unless({
    path: [/\/adduser/, /\/login/] //jwt
}))

mention the front of all app.use ()


I have the same problem. The route is not going anywhere. How does the landlord handle it?

Menu