I wrote an API using Laravel. I'd like all my endpoints to be publicly accessible, but I'd like to increase the rate limit for users who authenticate (I'm using Passport and OAuth 2.0).
I'd like to so something like this in my route:
Route::middleware('api')->post( .... ) {
// If OAuth Bearer token exists in header, try to use it to login
if (Auth::check())
{
// Increase rate limit for logged in user.
}
...
}
Taking it a step further, I'd like to adjust the rate limit, not only based on if the user is logged in, but also what type of user they logged in as. (Such as paid tiers). But I'd be happy to get as far as authenticated vs not.
Any pointers on how to go about doing this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire