linted
This commit is contained in:
parent
c374f54307
commit
c1103a54e8
10
index.ts
10
index.ts
|
@ -5,7 +5,7 @@ import {
|
|||
ValidateJWTTokenInput,
|
||||
ValidateJWTTokenResponse,
|
||||
} from '@authorizerdev/authorizer-js'
|
||||
import Server, { onAuthenticatePayload } from '@hocuspocus/server';
|
||||
import Server, { onAuthenticatePayload } from '@hocuspocus/server'
|
||||
|
||||
const authorizer = new Authorizer({
|
||||
clientID: process.env.AUTHORIZER_CLIENT_ID,
|
||||
|
@ -19,7 +19,6 @@ const server = await Server.configure({
|
|||
connection.requiresAuthentication = true
|
||||
},
|
||||
async onAuthenticate(data: onAuthenticatePayload) {
|
||||
|
||||
if (data.requestHeaders) {
|
||||
const params: ValidateJWTTokenInput = {
|
||||
token_type: 'access_token',
|
||||
|
@ -33,12 +32,11 @@ const server = await Server.configure({
|
|||
console.debug(`user_id: ${user} roles: ${roles}`)
|
||||
return {
|
||||
id: user,
|
||||
roles
|
||||
roles,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error('no valid auth token presented')
|
||||
throw new Error("Not authorized!")
|
||||
}
|
||||
throw new Error('Not authorized!')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"main": "index.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"fix": "npx @biomejs/biome check --fix --apply-unsafe .",
|
||||
"fix": "npx @biomejs/biome check --apply-unsafe .",
|
||||
"start": "npx tsc index.ts"
|
||||
},
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue
Block a user