Pre Registation Flow with SAML User

Hello community,

I am currently working on an SSO Integration where Salesforce is the identity provider.
As we have users already in Auth0 and want them to be able to log in via Salesforce we created a SAML connection where Salesforce is the identity provider.
In this case, a new user will be created at the first login in Auth0. So we want to create an pre signup flow that links the SAML user to the real user.

First I wanted to try the flow. I created a simple action:

exports.onExecutePreUserRegistration = async (event, api) => {
  api.user.setUserMetadata("account_id", "someuserid");  
}

So I expected to have the account_id in the SAML user. But it does not work.
If I create a user within Auth0, the user metadata account_id is added.

Is there a reason why the flow does not work for a user created from the SAML process?

Best,

Marc

Hi @marc.porst ,

The Pre User Registration Flow only works with Auth0 Database and Passwordless Users. I think you’ll need to use a Post Login Action, since you will only know who the user is when they are in fact logged in with the IdP and redirected back to Auth0.

1 Like

Hey @nathan.jenkins,

thank you so much for your help. It is working now.
I just did not figure out if I could link the accounts via the ManagementClient in the action. So I used axios to make the call to auth0.

Best,

Marc

1 Like

Hi @marc.porst ,
Good to hear!
Account Linking in Actions will be arriving later this month, its currently a known limitation but the product team aims to have this feature available very soon. Keep an eye on the Auth0 Changelog for the announcement.
Thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.