Open crazcdll opened 6 years ago
Hi. @zcdll
you can change the 29 line in the app/Providers/AuthServiceProvider.php
file.
like this.
Passport::routes(function ($router) {
/** @var \Laravel\Passport\RouteRegistrar $router */
$router->forAuthorization();
$router->forTransientTokens();
$router->forClients();
$router->forPersonalAccessTokens();
// Passport Routes
\Route::post('/token', [
'uses' => 'AccessTokenController@issueToken',
// 'middleware' => 'throttle',
]);
\Route::group(['middleware' => ['web', 'auth']], function ($router) {
$router->get('/tokens', [
'uses' => 'AuthorizedAccessTokenController@forUser',
]);
$router->delete('/tokens/{token_id}', [
'uses' => 'AuthorizedAccessTokenController@destroy',
]);
});
});
Thx. @qiutuleng
My app/Providers/AuthServiceProvider.php
just looks like below
public function boot()
{
$this->registerPolicies();
Passport::routes();
// Token Lifetimes
// Passport::tokensExpireIn(Carbon::now()->addDays(15));
// Refresh Token Lifetimes
// Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));
// Pruning Revoked Tokens
// Passport::pruneRevokedTokens();
// Token Scopes
// Passport::tokensCan([
// 'place-orders' => 'Place orders',
// 'check-status' => 'Check order status',
// ]);
}
What you mean is to overwrite the Passport::routes()
?
@zcdll yes
@zcdll You can refer to here RouteRegistrar.php It's the laravel official source code.
I just copy the forAccessTokens
function code and disable throttle middleware.
example:
before:
after:
@qiutuleng OK! Thanks a lot!
Hi, this is a nice package but I think that the developers have stopped working on it. Maybe you can try this package: https://github.com/Muhammadinaam/speed-admin. It supports Laravel 8+.
Client error: 'POST http://api.XXX.com.cn/oauth/token' resulted in a '429 Too Many Requests' response: Too Many Attempts.
Hello, when I send some requests a little fast, I would got the error above.
I have try do modify the
throttle
config inroutes/web.php
androutes/api.php
, but nothing changed.THX!