Additionally, here is the script I was using to test:
const axios = require('axios');
const getToken = async () => {
const options = {
method: 'POST',
url: 'https://{DOMAIN}/oauth/token',
headers: { 'content-type': 'application/json' },
data: {
client_id: '{CLIENT_ID}',
client_secret: '{CLIENT_SECRET}',
audience: 'https://{DOMAIN}us.auth0.com/api/v2/',
grant_type: 'client_credentials',
},
};
try {
const res = await axios(options);
console.log('Token Request: ',res.status)
return res.data.access_token;
} catch (error) {
console.log(error);
}
};
const getUsers = async (token) => {
const options = {
method: 'GET',
url: 'https://{DOMAIN}/api/v2/users',
headers: { authorization: `Bearer ${token}` },
};
axios(options)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.log(error.response.data);
// Attempt to get a token on an error
getToken()
});
};
const testRateLimit = async () => {
const token = await getToken();
for (let i = 0; i < 11; i++) {
await getUsers(token);
}
};
testRateLimit();