Created
March 16, 2021 16:56
-
-
Save saltukalakus/67656b539b460e8da4b94f48ed9aa407 to your computer and use it in GitHub Desktop.
Sample Auth0 action to execute on a specific API and Application for adding a custom claim.
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
/** @type {CredentialsExchangeAction} */ | |
module.exports = async (event, context) => { | |
// This action works for an API with the API audience https://example.com/api along with an application with the | |
// client id 5drbxrf5qMc1KTFNEw6Wjrbw319pOiyW | |
if (event.audience === "https://example.com/api" && event.client.id === "5drbxrf5qMc1KTFNEw6Wjrbw319pOiyW") { | |
return { | |
customClaims: { | |
"https://www.customnamespace.com/some_key": "some value" | |
} | |
}; | |
} else { | |
return {}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment