Last active
April 4, 2019 17:05
-
-
Save chrisscott/4d5f349f0723b656bb225a9254c5c50f to your computer and use it in GitHub Desktop.
Auth0 Rule - Add claim to a token
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) { | |
// Roles should only be set to verified users. | |
if (!user.email || !user.email_verified) { | |
return callback(null, user, context); | |
} | |
if (user.app_metadata.drupal_role) { | |
context.idToken['https://example.com/drupal_role'] = user.app_metadata.drupal_role; | |
} | |
callback(null, user, context); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment