Skip to content

[Bug] authentik作为sso登录提供者,登录验证报错 #5056

Closed
@dalamudx

Description

📦 部署环境

Docker

📌 软件版本

v1.36.31

💻 系统环境

Ubuntu

🌐 浏览器

Chrome

🐛 问题描述

使用authentik作为sso,登录时发现lobechat报错了
image
authentik提供程序配置
image

容器配置

  lobechat:
    image: reg.xxxxxx.com/lobehub/lobe-chat:latest
    container_name: lobechat
    networks:
      - traefik
    expose:
      - 3210
    environment:
      - NEXT_PUBLIC_SERVICE_MODE=server
      - NEXT_AUTH_SECRET=xxxxxxxxxxxxx
      - NEXT_AUTH_SSO_PROVIDERS=authentik
      - NEXTAUTH_URL=https://openai.xxxxxxx.com/api/auth
      - APP_URL=https://openai.xxxxxxx.com
      - KEY_VAULTS_SECRET=xxxxxxxxxxxxxxx
      - DATABASE_URL=postgres://lobechat:xxxxxxxx@postgres:5432/lobechat
      - AUTH_AUTHENTIK_ID=xxxxxxxxxxxxx
      - AUTH_AUTHENTIK_SECRET=xxxxxxxxxxxx
      - AUTH_AUTHENTIK_ISSUER=https://auth.xxxxxx.com/application/o/openai/
      - OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
      - ACCESS_CODE=xxxxxxxxxxxxxxxxx
    volumes:
      - /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt

日志

next auth: undefined
next auth: undefined
2024/12/17 06:49PM 30 pid=8 hostname=ceb93c2e2fd4 msg=Error in tRPC handler (lambda) on path: file.getFiles, type: query
a [TRPCError]: UNAUTHORIZED
    at /app/.next/server/chunks/93519.js:1:1932
    at f (/app/.next/server/chunks/88615.js:4:74)
    at r (/app/.next/server/chunks/88615.js:1:5810)
    at /app/.next/server/chunks/20516.js:1:7781
    at Array.map (<anonymous>)
    at g (/app/.next/server/chunks/20516.js:1:7318)
    at async _ (/app/.next/server/app/(backend)/trpc/lambda/[trpc]/route.js:1:3799)
    at async /app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36932
    at async eC.execute (/app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:27548)
    at async eC.handle (/app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:38186) {
  cause: undefined,
  code: 'UNAUTHORIZED'
}
a [TRPCError]: UNAUTHORIZED
    at /app/.next/server/chunks/93519.js:1:1932
    at f (/app/.next/server/chunks/88615.js:4:74)
    at r (/app/.next/server/chunks/88615.js:1:5810)
    at /app/.next/server/chunks/20516.js:1:7781
    at Array.map (<anonymous>)
    at g (/app/.next/server/chunks/20516.js:1:7318)
    at async _ (/app/.next/server/app/(backend)/trpc/lambda/[trpc]/route.js:1:3799)
    at async /app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36932
    at async eC.execute (/app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:27548)
    at async eC.handle (/app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:38186) {
  cause: undefined,
  code: 'UNAUTHORIZED'
}
2024/12/17 06:49PM 30 pid=8 hostname=ceb93c2e2fd4 msg=Error in tRPC handler (lambda) on path: knowledgeBase.getKnowledgeBases, type: query
[auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: r1: JWE decryption is not configured
    at iu (/app/.next/server/chunks/43505.js:368:22709)
    at nj (/app/.next/server/chunks/43505.js:368:16136)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async nB (/app/.next/server/chunks/43505.js:368:18803)
    at async iH (/app/.next/server/chunks/43505.js:368:34416)
    at async iz (/app/.next/server/chunks/43505.js:368:40333)
    at async i0 (/app/.next/server/chunks/43505.js:368:51902)
    at async i2 (/app/.next/server/chunks/43505.js:368:56596)
    at async /app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36932
    at async eC.execute (/app/node_modules/.pnpm/next@14.2.8_@babel+core@7.26.0_@opentelemetry+api@1.9.0_@playwright+test@1.49.1_react-d_1cf2c798572f9d55dae58de467e3f455/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:27548)
[auth][details]: {
  "0": "e",
  "1": "y",
  "2": "J",
  "3": "h",
  "4": "b",
  "5": "G",
  "6": "c",
  "7": "i",
  "8": "O",
  "9": "i",
  "10": "J",
  "11": "S",
  "12": "U",
  "13": "0",
  "14": "E",
  "15": "t",
  "16": "T",
  "17": "0",
  "18": "F",
  "19": "F",
  "20": "U",
  "21": "C",
中间有很长一部分类似日志就不贴了
  "2897": "Y",
  "2898": "s",
  "2899": "q",
  "2900": "U",
  "2901": "Y",
  "2902": "-",
  "2903": "P",
  "2904": "G",
  "2905": "e",
  "2906": "f",
  "2907": "I",
  "2908": "A",
  "provider": "authentik"
}
[NextAuth] Error: {
  cause: 'Configuration',
  message: 'Wrong configuration, make sure you have the correct environment variables set. Visit https://lobehub.com/docs/self-hosting/advanced/authentication for more details.',
  name: 'NextAuth Error'
}

📷 复现步骤

按照上述配置部署lobechat

🚦 期望结果

No response

📝 补充信息

No response

Metadata

Assignees

No one assigned

    Labels

    🐛 BugSomething isn't working | 缺陷

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions