A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.
chore: make error messages for auth errors more detailed (#2041)
Meier Lukasb9271ba14acc
diff --git a/packages/auth/configuration.ts b/packages/auth/configuration.tsindex 96bba6723..a1bf9b665 100644--- a/packages/auth/configuration.ts+++ b/packages/auth/configuration.ts@@ -2,9 +2,11 @@ import type { ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapteimport { cookies } from "next/headers";import NextAuth from "next-auth";import Credentials from "next-auth/providers/credentials";+import { formatError } from "pretty-print-error";import { db } from "@homarr/db";import type { SupportedAuthProvider } from "@homarr/definitions";+import { logger } from "@homarr/log";import { createAdapter } from "./adapter";import { createSessionCallback } from "./callbacks";@@ -26,15 +28,16 @@ export const createConfiguration = (const adapter = createAdapter(db, provider);return NextAuth({logger: {- error: (code, ...message) => {+ error: (error) => {// Remove the big error message for failed login attempts// as it is not useful for the user.- if (code.name === "CredentialsSignin") {- console.warn("The login attempt of a user was not successful.");+ if (error.name === "CredentialsSignin") {+ logger.warn("The login attempt of a user was not successful.");return;}- console.error(code, ...message);+ logger.error(formatError(error));+ logger.error(formatError(error.cause));},},trustHost: true,diff --git a/packages/auth/package.json b/packages/auth/package.jsonindex 7e330ea10..86ae05d76 100644--- a/packages/auth/package.json+++ b/packages/auth/package.json@@ -36,6 +36,7 @@"ldapts": "7.3.1","next": "15.1.5","next-auth": "5.0.0-beta.25",+ "pretty-print-error": "^1.1.2","react": "19.0.0","react-dom": "19.0.0"},diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex aa659486c..33644f728 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -642,6 +642,9 @@ importers:next-auth:specifier: 5.0.0-beta.25version: 5.0.0-beta.25([email protected](@babel/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])+ pretty-print-error:+ specifier: ^1.1.2+ version: 1.1.2(patch_hash=4arrfgbz7em6s4gqywse7esg4u)react:specifier: 19.0.0version: 19.0.0