diff --git a/index.ts b/index.ts index d0b27d6..d73ac25 100644 --- a/index.ts +++ b/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!") } + console.error('no valid auth token presented') + throw new Error('Not authorized!') } } }, diff --git a/package.json b/package.json index 1f7c70c..d3e2ee0 100644 --- a/package.json +++ b/package.json @@ -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": {