In Laravel\Passport\RouteRegistrar class, inside forAccessTokensmethod, the registered middleware throttle is not configurable.
see:
$this->router->post('/oauth/token', [
'uses' => 'AccessTokenController@issueToken',
'middleware' => 'throttle'
]);
I think we need some way to edit the maxAttempts and decayMinutes without extending the actual middleware class.
@erdemkeren The quickest way for you to solve this is to overwrite the route and still point to the right controller. In your RouteServiceProvider's map method, you could do something like the following.
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
Route::post('/oauth/token', [
'uses' => '\Laravel\Passport\Http\Controllers\AccessTokenController@issueToken',
'middleware' => 'throttle:60,5',
]);
}
I will gladly submit a PR for this after the holidays though if no one else does it beforehand and it isn't deemed unnecessary by @taylorotwell or @themsaid. Hopefully this solves your problem in the meantime though :)
@erdemkeren Taylor decided he'd like to keep the defaults, so go ahead and stick with the solution I gave above. You can also close this issue when you get a chance. Thanks!
@craigpaul Thanks for your interest. Already guessed that and done that way.
@craigpaul Thank you very much!
@craigpaul question, is there a way to catch the error inside RouteServiceProvider's map method?
Most helpful comment
@erdemkeren The quickest way for you to solve this is to overwrite the route and still point to the right controller. In your
RouteServiceProvider'smapmethod, you could do something like the following.I will gladly submit a PR for this after the holidays though if no one else does it beforehand and it isn't deemed unnecessary by @taylorotwell or @themsaid. Hopefully this solves your problem in the meantime though :)