Map SAML attributes to user_metadata attributes via action

The following page mentions how we can map user_metadata to saml response

however as rules are going to be deprecated, how do we write action to accomplish this?

1 Like

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

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!