Map SAML attributes to user_metadata attributes via action

I’m also interested in this question. I have tried setting up Actions to do this, but could not get it to work.

In my specific case, I am trying to get a hard-coded value in Auth0’s SAML response when Auth0 is the IDP, but can’t make it work.

I’m following How to Map SAML Attributes when Auth0 is the IDP in the SAML2 Addon,
specifically case 5 (“Mapping hard-coded values that don’t exist in the user profile to the SAML Response”), but instead of a Rule I’m using an Action as such:

exports.onExecutePostLogin = async (event, api) => {
  event.user.saml_mapping_helper_bool_true = "true";
};

In my Auth0 App, I have SAML enabled with the following settings (I’m showing only the subset that matters below):

{
  "mappings": {
    "email": "User.Email",
    "name": "User.FirstName",
    "saml_mapping_helper_bool_true": "User.EmailNotifications"
  }
}

I’ve double checked this action is applied in the Login flow. I also tried mapping saml_mapping_helper_bool_true to “User.FirstName” instead
because I had verified that User.FirstName works in the SP, but it still doesn’t pick it up.

I wonder what I’m missing here.

1 Like