I am using Auth0 management API to create user invitation with a role to be assigned to the user as seen below;
let params = { id : req.params.organisationId};
let data = {
client_id: ‘MY CLIENT ID’,
invitee: { email: req.body.email },
inviter: { name: req.body.inviter },
roles: [‘rol_m3qbxCMGB7uBr7z4’]
};
auth0.managementApi.organizations.createInvitation(params, data, function (err) {
if (err) {
console.log(“Unable to send invite>>>”,err)
res.status(201).send({msg:“Unable to add organisations”,data:err});
}
else{
console.log("Invite sent successfully>>>",data)
res.status(201).send({msg:"Invite sent successfully",data:data});
}
});
The invitation is sent to the user, and he is able to sign up to the organisation. However the role specified is not added to him when i check the Auth0 dashboard.Everything works fine but the role is not applied to the signed up user. Please help me out. Thank you