Auth0 Home Blog Docs

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

rate-limit
unit-testing

#1

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


#2

Can you explain your use-case in more detail?


#3

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?


#4

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


#5

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.


#6

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


#7