Auth0 Update SAML IdP user's name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (user, context, callback) { | |
var ManagementClient = require('auth0@2.9.1').ManagementClient; | |
let saml_name = `${user.first_name} ${user.last_name}`; | |
console.log(saml_name); | |
user.name = saml_name; | |
var management = new ManagementClient({ | |
token: auth0.accessToken, | |
domain: auth0.domain | |
}); | |
management.users.update({id: user.user_id}, { | |
"name": saml_name | |
}, function (err, users) { | |
if (err) { | |
// Handle error. | |
console.log(err); | |
return callback(err); | |
} | |
console.log(user); | |
callback(null, user, context); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment