I've followed this and I'm able to return firstname, lastname, username, and email without issues. I'm trying to map our LDAP using the keycloak mapping directory here. I'm succesful at getting LDAP fields to a
Here is a working example of a express router that returns keycloak data after a succesful login. I see I'm not the only one using the attributes to map LDAP data.
The question: How can I get userdetail information from keycloak from these custom attributes (mappings) into an express server? I don't think its documented.
var express = require("express");
var router = express.Router();
/* GET home page. */
router.get("/", function(req, res, next) {
console.log(req.kauth.grant.access_token.content);
res.render("index", {
title: "FORM-ARWD",
username: req.kauth.grant.access_token.content.preferred_username,
firstname: req.kauth.grant.access_token.content.given_name,
lastname: req.kauth.grant.access_token.content.family_name,
email: req.kauth.grant.access_token.content.email,
city: req.kauth.grant.access_token.content.l
});
});
module.exports = router;