style: run npm run format
This commit is contained in:
parent
6ea9d6f933
commit
243a598f37
@ -2,7 +2,7 @@ import jwt from 'jsonwebtoken'
|
||||
|
||||
class UnauthorizedError extends Error {
|
||||
public inner: { message: string }
|
||||
public data: { message: string; code: string; type: 'UnauthorizedError' }
|
||||
public data: { message: string, code: string, type: 'UnauthorizedError' }
|
||||
|
||||
constructor (code: string, error: { message: string }) {
|
||||
super(error.message)
|
||||
@ -190,8 +190,8 @@ export function authorize(options: any) {
|
||||
if (authorization_header) {
|
||||
const parts = authorization_header.split(' ')
|
||||
if (parts.length == 2) {
|
||||
const scheme = parts[0],
|
||||
credentials = parts[1]
|
||||
const scheme = parts[0]
|
||||
const credentials = parts[1]
|
||||
|
||||
if (scheme.toLowerCase() === 'bearer') {
|
||||
token = credentials
|
||||
@ -282,7 +282,7 @@ function getSecret(request: any, secret: any, token: any, callback: Function) {
|
||||
})
|
||||
}
|
||||
|
||||
let decodedToken: any = jwt.decode(token, { complete: true })
|
||||
const decodedToken: any = jwt.decode(token, { complete: true })
|
||||
|
||||
if (!decodedToken) {
|
||||
return callback({ code: 'invalid_token', message: 'jwt malformed' })
|
||||
|
Reference in New Issue
Block a user