Too many logins with the same username or email while running unit tests

I tried to search for an answer to this question with no luck.

I have around 100 unit tests each authenticating (POST https://myname.eu.auth0.com/oauth/ro), but I am running into the “Too many logins…” error. I am doing 2-3-4 calls per second. I am aware about the rate limits, but is there any way I can get my unit tests run this fast without a setTimeout between each test?

I am on the Developer paid subscription.

Thanks,
Thomas

Can you explain your use-case in more detail?

I have around 100 BDD style tests. Each of them authenticates a user and calls a route for testing. But I hit the rate limit maybe because the same user tries to authenticate too many times. So my question is really how do other people write unit tests calling the Auth0 api many times?

You should be caching that token, Auth0 has a limit on how many login attempts can happen on the same IP.

You should be caching the token issued as part of the authentication step, Auth0 has a limit on how many login attempts can happen on the same IP.

You are right, thanks. Don’t know why I didn’t think of that.