preliminaries…
NodeJs application:
“express-jwt”: “^6.1.0”,
“express-jwt-authz”: “^2.4.1”,
“express-openid-connect”: “^2.5.1”,
Platform Version: Nodejs 16.6.2
Issue…
So I am kinda new to nodejs and auth0 (altho not oauth and oidc) and I am struggling with several issues even following the basic how to 123 docs.
Issues:
- currently I have the app authenticating with auth0 via express-openid-connect BUT it only returns a basic user profile with a name email and sub (no roles, no JWT and no metadata).
exports.GetAuthentication = async ( req, res, next ) => {
try {
// weird note: If I stringify req.oidc i get "{}" but it obviously has props because req.oidc.user returns
//{"nickname":"mynick","name":"First Last","picture":"https://avatar.io/url","updated_at":"2021-10-08T12:55:06.694Z","email":"my@email.com","email_verified":true,"sub":"auth0|xxx"}
var user = req.oidc.user;
// none of the following returns anything other than undefined
// console.log(`${JSON.stringify(req.oidc)}`);
// const { token_type, access_token } = req.oidc.accessToken;
// console.log(` ${JSON.stringify(access_token)}`);
return res.status(200).json(user);
} catch(err) {
return next(err)
}
};
I have another ton of problems but we first I need to figure out how to get a JWT to auth against the API with.