From 0c24fd0c95916f43078a19ce6265dd3ae9f4a0aa Mon Sep 17 00:00:00 2001 From: alma Date: Thu, 17 Apr 2025 00:53:09 +0200 Subject: [PATCH] Neah version calendar fix 3 debuger sec chance danger debug 9 --- app/api/auth/[...nextauth]/route.ts | 3 +++ app/layout.tsx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index c54aea2..182d5b6 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -61,6 +61,9 @@ export const authOptions: NextAuthOptions = { callbacks: { async jwt({ token, account, profile }) { if (account && profile) { + if (!account.access_token || !account.refresh_token) { + throw new Error('Missing required token fields from Keycloak'); + } token.accessToken = account.access_token; token.refreshToken = account.refresh_token; token.accessTokenExpires = account.expires_at! * 1000; diff --git a/app/layout.tsx b/app/layout.tsx index 1da0682..5082627 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,7 +3,7 @@ import { Inter } from "next/font/google"; import "./globals.css"; import { headers } from "next/headers"; import { getServerSession } from "next-auth/next"; -import { authOptions } from "@/lib/auth"; +import { authOptions } from "@/app/api/auth/[...nextauth]/route"; import { Providers } from "@/components/providers"; import { LayoutWrapper } from "@/components/layout/layout-wrapper"; import { Toaster } from "@/components/ui/toaster";