FEAT: Enhance authentication system with internal API support, Keycloak connectivity diagnostics, and simplified client implementation
This commit is contained in:
36
server/api/debug/test-keycloak-connectivity.ts
Normal file
36
server/api/debug/test-keycloak-connectivity.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
console.log('[DEBUG] Testing Keycloak connectivity...')
|
||||
|
||||
try {
|
||||
// Test basic connectivity to Keycloak
|
||||
const wellKnownUrl = 'https://auth.portnimara.dev/realms/client-portal/.well-known/openid-configuration'
|
||||
|
||||
const response = await $fetch(wellKnownUrl, {
|
||||
retry: 0
|
||||
}) as any
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: 'Keycloak connectivity successful',
|
||||
endpoint: wellKnownUrl,
|
||||
response: {
|
||||
issuer: response.issuer,
|
||||
authorization_endpoint: response.authorization_endpoint,
|
||||
token_endpoint: response.token_endpoint,
|
||||
userinfo_endpoint: response.userinfo_endpoint
|
||||
}
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('[DEBUG] Keycloak connectivity test failed:', error)
|
||||
|
||||
return {
|
||||
success: false,
|
||||
message: 'Keycloak connectivity failed',
|
||||
error: {
|
||||
message: error.message,
|
||||
status: error.status,
|
||||
cause: error.cause?.message
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user