thephpleague / oauth2-client

Easy integration with OAuth 2.0 service providers.

Home Page:http://oauth2-client.thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion - a very small code change would implement rate limiting

globalvisionmedia opened this issue · comments

a lot of APIs have rate limiting but...

If you were to add:
$client_options = ['timeout', 'proxy', 'handler'];

then we could use this: composer require spatie/guzzle-rate-limiter-middleware and write apps that include (for example)

$stack = HandlerStack::create();
$stack->push(RateLimiterMiddleware::perSecond(8));

$provider = new Provider([
'clientId' => MYOB_CLIENT_ID,
'clientSecret' => MYOB_CLIENT_SECRET,
'redirectUri' => CALLBACK_URI,
'username' => USERNAME,
'password' => PASSWORD,
'scopes' => ['CompanyFile'],
'handler' => $stack
]);