equipes keycloak flow
This commit is contained in:
parent
d99e10067d
commit
5bd2cb33bf
@ -3,8 +3,13 @@ import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||
import { getKeycloakAdminClient } from "@/lib/keycloak";
|
||||
|
||||
// Fix for Next.js "params should be awaited" error
|
||||
export const dynamic = 'force-dynamic';
|
||||
// Fix for Next.js "params should be awaited" error - temporarily disabled
|
||||
// export const dynamic = 'force-dynamic';
|
||||
|
||||
// @ts-ignore - disable dynamic route params warning
|
||||
export const config = {
|
||||
runtime: 'nodejs'
|
||||
};
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
|
||||
@ -28,23 +28,6 @@ export async function getKeycloakAdminClient(): Promise<KcAdminClient> {
|
||||
const adminPassword = process.env.KEYCLOAK_ADMIN_PASSWORD;
|
||||
const realmName = process.env.KEYCLOAK_REALM;
|
||||
|
||||
// Validate required environment variables
|
||||
if (!keycloakUrl) {
|
||||
console.error('Missing Keycloak URL. Please add one of these to your .env file: KEYCLOAK_BASE_URL, KEYCLOAK_ISSUER, or NEXT_PUBLIC_KEYCLOAK_ISSUER');
|
||||
throw new Error('Missing Keycloak URL configuration');
|
||||
}
|
||||
|
||||
if (!adminClientId || !adminUsername || !adminPassword || !realmName) {
|
||||
const missing = [];
|
||||
if (!adminClientId) missing.push('KEYCLOAK_ADMIN_CLIENT_ID');
|
||||
if (!adminUsername) missing.push('KEYCLOAK_ADMIN_USERNAME');
|
||||
if (!adminPassword) missing.push('KEYCLOAK_ADMIN_PASSWORD');
|
||||
if (!realmName) missing.push('KEYCLOAK_REALM');
|
||||
|
||||
console.error(`Missing Keycloak admin credentials in .env: ${missing.join(', ')}`);
|
||||
throw new Error('Missing Keycloak admin credentials');
|
||||
}
|
||||
|
||||
console.log(`Connecting to Keycloak at ${keycloakUrl}, realm: ${realmName}`);
|
||||
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user