Good day, I've successfully implemented oauth authentication against a keycloak
server using @exlinc/keycloak-passport
. I am now trying to use information (roles) from the keycloak server to determine what access/permissions is granted as suggested in this question . In order to do so I need to understand what information is present on the profile and accessToken returned by the keycloak server, so Im trying to log this information to the console but am not seeing anything when viewing the log.
Im running node-red version 2.1.4 using the nodered/node-red docker image, and viewing the logs using docker logs container_name
What is the correct way to log info in this context, and where should I be looking to see the log output?
Thanks in advance for any help.
adminAuth: {
type: "strategy",
strategy: {
name: "Keycloak",
label: 'Sign in',
icon: "",
strategy: require("@exlinc/keycloak-passport"),
options: {
host: "https://mykeycloak",
realm: "myrealm",
clientID: "nodered",
clientSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
callbackURL: "https://mynodered/auth/strategy/callback",
authorizationURL: "https://mykeycloak/auth/realms/myrealm/protocol/openid-connect/auth",
tokenURL: "https://mykeycloak/auth/realms/myrealm/protocol/openid-connect/token",
userInfoURL: "https://mykeycloak/auth/realms/myrealm/protocol/openid-connect/userinfo"
},
verify: function (accessToken, refreshToken, profile, done) {
console.log("Test logging"); // not working or not sure where output is logged to
console.log(profile); // not working or not sure where output is logged to
done(null, profile);
}
},
users: [
{ username: "user1@example.com", permissions: ["*"] },
{ username: "user2@example.com", permissions: ["*"] }
]
},