Please include the following information in your post:
- SDK Verion: express-openid-connect: “^2.5.1”,
*Platform Version: NodeJs 16.6.2
I am using nodejs and express openid connect and I am trying to get ALL of the user the metadata from auth0.
here’s the route:
const authenticationController = require("../controllers/auth.controller");
const { auth, requiresAuth } = require('express-openid-connect');
module.exports = function(app, cors, corsOptions) {
app.get('/authentication',
cors(corsOptions),
requiresAuth(),
function (req, res, next) {
authenticationController.GetAuthentication( req, res, next );
});
};
here’s the controller:
exports.GetAuthentication = async ( req, res, next ) => {
try {
var user = req.oidc.user;
return res.status(200).json(user);
} catch(err) {
return next(err)
}
};
Here is the output:
{"nickname":"mynick"
,"name":"First Last",
"picture":"https://s.gravatar.com/avatar/xxx?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fso.png",
"updated_at":"2021-10-17T15:39:14.845Z",
"email":"user@domain.tld","email_verified":true,"sub":"auth0|123456xxx"}
As you can see none of the metadata for my user is showing up in the user object. How do I get the metadata?