guzzle/plugin-oauth
Guzzle OAuth plugin adding OAuth 1.0 request signing to your HTTP clients. Helps authenticate against APIs requiring OAuth headers or query params by attaching the proper signature to outgoing requests. Suitable for legacy OAuth 1 services.
Pros:
HttpClient facade or GuzzleHttp\Client).laravel/socialite) or as a standalone solution for custom OAuth workflows.Cons:
oauth.* events).HttpClient facade by configuring a custom Guzzle client with the OAuth plugin.
use GuzzleHttp\Client;
use Guzzle\Plugin\Oauth\OauthPlugin;
$client = new Client([
'base_uri' => 'https://api.example.com',
]);
$client->addSubscriber(new OauthPlugin([
'consumer_key' => 'key',
'consumer_secret' => 'secret',
'token' => 'token',
'token_secret' => 'token_secret',
]));
GuzzleHttp\Psr7 in Guzzle 6+).symfony/http-client in Laravel 10+).league/oauth2-client for broader support.guzzlehttp/oauth-subscriber)?oauth2-client storage)?symfony/oauth-client.HttpClient (Guzzle 6/7) if wrapped in a custom client or middleware.Illuminate\Support\Facades\Http via a macro or custom resolver.league/oauth2-client or symfony/oauth-client (better Laravel integration).guzzlehttp/oauth-subscriber (active maintenance).cache()->remember()) or encrypted database fields.guzzlehttp/oauth-subscriber (Guzzle 6+).$this->app->singleton('oauthClient', function () {
$client = new Client();
$client->addSubscriber(new OauthPlugin(config('services.oauth')));
return $client;
});
HttpClient with a macro to inject OAuth logic.
Http::macro('oauth', function ($guard) {
return Http::withOptions(['oauth' => config("services.oauth.$guard")]);
});
symfony/http-client; prefer Symfony’s OAuth client.monolog channel).oauth2-client) and sunset the legacy code.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Expired/Invalid Token | API requests fail with 401/403 | Auto-refresh tokens or prompt user re-auth. |
How can I help you explore Laravel packages today?