/** * @param {Event} event - Details about client credentials grant request. * @param {CredentialsExchangeAPI} api - Interface whose methods can be used to change the behavior of client credentials grant. */exports.onExecuteCredentialsExchange = async (event, api) => { if (event.request.geoip.continentCode === "NA") { api.access.deny('invalid_request', "Access from North America is not allowed."); }};
/** * @param {Event} event - Details about client credentials grant request. * @param {CredentialsExchangeAPI} api - Interface whose methods can be used to change the behavior of client credentials grant. */exports.onExecuteCredentialsExchange = async (event, api) => { api.accessToken.setCustomClaim("https://my-api.exampleco.com/request-ip", event.request.ip); };