Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Salesforce Auth0 rule. This is the default mapping Auth0 will use for Salesforce. You can create a new Rule and change this with whatever you want.
function (user, context, callback) {
//
// this rule can be used if you have chosen to use Username as the way to identify a user in Salesforce. Notice that we are mapping the email to the nameidentifier.
//
if (context.clientName === 'Salesforce') {
context.samlConfiguration.mappings = {
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier': 'email',
'User.Username': 'email',
'User.Email': 'email',
'User.FirstName': 'given_name',
'User.ProfileId': 'salesforce_profile_id',
'User.LastName': 'family_name'
}
}
callback(null, user, context)
}
function (user, context, callback) {
if (context.clientName === 'Salesforce') {
context.samlConfiguration.mappings = {
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier': 'user_id',
'User.Username': 'email',
'User.Email': 'email',
'User.FirstName': 'given_name',
'User.ProfileId': 'salesforce_profile_id',
'User.LastName': 'family_name'
}
}
callback(null, user, context)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment