const excludeUrl = [ "/user/getUserToken" , '/user/getTokenByApp' ] ; export default ( ) => { author : Cookie
     *  description const jwtAuth = async ( ctx , next ) => { if ( excludeUrl . includes ( ctx . request . path ) ) { await next ( ) ; return ; } const token = ctx . cookies . get ( 'authorization' ) || ctx . request . header . authorization ; if ( token ) { try { const deCode = ctx . app . jwt . verify ( token . replace ( "Bearer " , "" ) , ctx . app . config . jwt . secret ) ; console . log ( deCode ) ; ctx . user = deCode ; await next ( ) ; } catch ( error ) { ctx . status = 401 ; ctx . body = { code : 401 , message : error . message , } ; } return ; } ctx . status = 401 ; ctx . body = { code : 401 , message : "验证失败" , } ; return ; } ; return jwtAuth ; } ;