Overview
This article will provide a step-by-step guide on how to enforce Proof Key for Code Exchange (PKCE) using post-login actions.
Applies To
- Proof Key for Code Exchange (PKCE)
- Actions
Solution
- Navigate to https://manage.auth0.com/;
- On the Dashboard, click on Actions > Library
- On the top right corner, click on Create Action > Build From Scratch
- Choose the desired name, and the Trigger should be Login / Post Login
- Use the code snippet provided below and adjust it as required
- Deploy and add the action to the trigger
exports.onExecutePostLogin = async (event, api) => {
const code_challenge = event.request.query.code_challenge;
if (!code_challenge) {
api.access.deny("You are not allowed to Login")
}
};