[keycloak-user] node adapter

Greet Robijns greetrobijns at gmail.com
Fri Mar 15 09:26:18 EDT 2019


Hi all,

I followed the instructions on
https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_adapter
to add a keycloak to my express server.

my routes are handled by react on the client side.

However I only get "access denied" and no redirection to the authentication
page?

My configuration:

var session = require("express-session");
var Keycloak = require("keycloak-connect");
connectWithRetry();
var memoryStore = new session.MemoryStore();
let kcConfig = {
    realm: "Marketing Console",
    url: "http://localhost:8080/auth",
    clientId: "marketing_console",
    "bearer-only": true,
    "ssl-required": "none",
    "enable-cors": true,
    "public-client": true
};

app.use(
    session({
        secret: "mySecret",
        resave: false,
        saveUninitialized: true,
        store: memoryStore
    })
);

let keycloak = new Keycloak({ store: memoryStore }, kcConfig);

app.get("/", keycloak.protect());


Kind Regards
Greet Robijns


More information about the keycloak-user mailing list