nicholastay / passport-discord

Passport strategy for authentication with Discord (discordapp.com)
ISC License
172 stars 55 forks source link

Delay fetching guilds #28

Open fsjuhl opened 4 years ago

fsjuhl commented 4 years ago

When experiencing a lot of requests, you sometimes get rate limited on fetching guilds. This allows you to add a scopeDelay to avoid it. Solves issue #27

tonestrike commented 3 years ago

@fsjuhl I think this might be related to the fact that the first callback is not returned if there is an error: https://github.com/nicholastay/passport-discord/blob/f8c55dcd34bd20bf692604d69db776c63ad1b91b/lib/strategy.js#L100

I have returned the callback in my fork of the library and haven't ever run into the issue you are describing. You can check out there changes here: https://github.com/tonestrike/passport-discord.

My theory is that since this is sometimes erroring, it will cause issues for your user who would then try to login again quickly and get the rate limit. Discord only typically rate limits if you make an identical request too fast.