Skip to content

Commit

Permalink
debug: add logging for Keycloak initialization
Browse files Browse the repository at this point in the history
RISDEV-6773
  • Loading branch information
andreasphil committed Feb 17, 2025
1 parent b233244 commit ad40752
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ function createAuthentication() {
async function configure(config: AuthenticationConfig): Promise<void> {
keycloak = new Keycloak(config)

console.log("[auth debug] created Keycloak with config")
console.log(config)
console.log("[auth debug] location: ", window.location.href)

try {
await keycloak.init({
onLoad: "login-required",
checkLoginIframe: false,
pkceMethod: "S256",
scope: "profile email",
})

console.log("[auth debug] initialized Keycloak", keycloak)
} catch (e) {
keycloak = undefined
throw new Error("Failed to initialize authentication", { cause: e })
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ try {
.use(router)
.use(Sentry, { environment: env.name, router })

console.log("[auth debug] location when creating app: ", window.location.href)
console.log("[auth debug] created app")

// Configure authentication
const auth = useAuthentication()
await auth.configure({
Expand All @@ -36,8 +39,11 @@ try {
realm: env.authRealm,
})

console.log("[auth debug] configured authentication")

// If all initialization succeeds, mount app
app.mount("#app")
console.log("[auth debug] mounted app")
} catch (e: unknown) {
// If an error occurs above, catch it here

Expand Down

0 comments on commit ad40752

Please sign in to comment.