Last active
October 10, 2018 21:24
-
-
Save abbaspour/ecea4d6a91560f8594323d823ed70ca8 to your computer and use it in GitHub Desktop.
extend access token
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) { | |
| let role = user.app_metadata.role || 'limied-authority'; | |
| if (role === 'legal-lessee' || role === 'full-authority') | |
| context.accessToken.scope = ['read:usage', 'read:bill', 'pay:bill', 'update:email']; | |
| else | |
| context.accessToken.scope = ['read:bill']; | |
| context.accessToken['http://custom.ns/role'] = role; // plain text role, for audit | |
| callback(null, user, context); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment