On Fri, Mar 15, 2019 at 2:33 PM Greet Robijns <greetrobijns(a)gmail.com>
wrote:
Hi all,
I followed the instructions on
https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_ada...
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?
No redirect is correct since you flagged your nodejs app with
"bearer-only".
How does the frontend send the request to the backend ? Are you using the
javascript adapter to obtain the token ?
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
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user