tsed
tsed copied to clipboard
[BUG] Page Keycloak - /tutorials/keycloak
If I try this example, but I get an error when starting the server:
TypeError: Cannot read properties of undefined (reading 'getMemoryStore')
I debug this a little bit and find out, the "store" configuration property is evaluated before the KeycloakService is injected. So, the this.keycloakService.getMemoryStore() fails.
Hello @xCryzed Can you clarify this part of the doc please ;)
see you
This solves the problem: Remove the session from the middleware and initialize the session in the $beforeRouteInit() method
$beforeRoutesInit(): void {
$log.info("beforeRoutesInit call")
this.app.use(session({
secret: "thisShouldBeLongAndSecret",
resave: false,
saveUninitialized: true,
store: this.keycloakService.getMemoryStore()
}));
this.app.use(this.keycloakService.getKeycloakInstance().middleware());
}
Oops. I think the wrong example come from me when I refactored all code example. My Bad!!
Thanks for the PR ;)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.