Created
July 12, 2019 04:45
-
-
Save ShayMe21/a2f346da6391e0281c2872465f7dcb5f to your computer and use it in GitHub Desktop.
Auth0 Update SAML IdP user's name
This file contains hidden or 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('[email protected]').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