curl --request POST
–url https://xxxxx.us.auth0.com/oauth/token
–header ‘content-type: application/json’
–data ‘{“client_id”:“xxxxx”,“client_secret”:“xxxx”,“audience”:“https://zasacloud/api",“grant_type”:“client_credentials”,“username”:“test@tst.com”,“password”:"xxxx”}’
I am sending above request to get the token, I am getting the token but not getting custom claims. Below is the code defined for passing custom clais in token
exports.onExecutePostLogin = async (event, api) => {
// This rule adds the authenticated user’s email address to the access token.
if (event.authorization) {
var namespace = ‘http://test’;
api.accessToken.setCustomClaim(${namespace}/email
, event.user.email)
api.idToken.setCustomClaim(${namespace}/email
, event.user.email)
api.idToken.setCustomClaim(${namespace}/preferred_contact
, “sms”);
api.accessToken.setCustomClaim(${namespace}/preferred_contact
, “sms”);
}
};
I am clueless on what is wrong with above steps. Also when I test the action, I see values, but not getting in return with aPI call.