rz/oauth-bundle
A Laravel package that bundles OAuth authentication support, helping you wire up OAuth providers and authorization flows in your PHP application with less boilerplate. Check the repository for supported providers, setup steps, and configuration details.
Orientation step: confirm which side of the fence you're on. rz/oauth-bundle is a Symfony bundle that extends HWIOAuthBundle and wires its social-login flow into RzUserBundle. It is not installable in a Laravel app, is archived, and has zero dependents. If you're on Laravel, your day-to-day equivalent is Laravel Socialite — but the patterns inside this package (identity → local user mapping) are worth reading before you write that code.
If you own a legacy Symfony app already pulling this in, read in this order:
composer.json — the pinned versions of hwi/oauth-bundle, friendsofsymfony/user-bundle, and the Symfony minor are the real constraint; they decide whether your next upgrade is possible. Everything else is secondary.DependencyInjection/ — the config tree is the actual public API. It exposes the hwi_oauth extension points, the user-provider wiring, and the service ids you can override.Resources/config/ — service definitions. Diff what the bundle registers vs. what it decorates on top of HWIOAuthBundle; the decorated services are the shim.Security/ — the resource-owner-to-user bridge. This is the only genuinely custom piece. Everything else is glue.First use case (pattern, not install): "log in with GitHub/Google, map remote identity to a local user." Concretely: an oauth_accounts table keyed by (provider, provider_user_id) with an FK to users.id. That mapping is the one concept worth lifting into your Laravel app, and it's ~40 lines of Socialite.
The useful work is extracting the patterns and rebuilding them on a supported stack. These are the ones the bundle encodes well:
findByProviderAndId() → else match by verified email → else create. Same logic the bundle's user provider runs; same logic you'll want in Laravel./auth/{provider}/redirect + /callback (login, unauthenticated) and /settings/connections/{provider}/link + /callback (connect, behind auth middleware). Never let a callback create-and-login a user when the intent was to link — that's an account-takeover vector.Socialite::driver($p)->stateless(). This is the analogue of HWIOAuthBundle's stateless resource owners. Get the state/cookie discipline right on day one or you'll debug InvalidStateException for a day.Socialite::extend() is the direct analogue of registering a custom resource owner in hwi_oauth.resource_owners. Put these in app/Socialite/ and register via a service provider — not inline in a controller.security.firewalls.main.oauth; the Laravel boundary is middleware + Auth::login(). Resolve identity in an action class (OAuthUserResolver), then hand off to your normal login path so session regeneration, guards, and any 2FA hooks still run. Don't call Auth::login() from deep inside the resolver.OAuthUserResolver in the container. That's the extension point the original bundle should have shipped with; it's what makes swapping providers (or adding Apple) cheap later.HWIOAuthBundle firewall and RzUserBundle produces "service not found" errors — not helpful ones. The common misdiagnosis is a missing bundle registration when the real cause is a missing hwi_oauth firewall config key.FOSUserBundle is deprecated, and rz/oauth-bundle is archived on top of both. Upgrading Symfony will force you off all three at once — scope it as one migration, not three.require.security panel and dump the firewall's token after callback. Most integration issues are the resource owner returning a response the user provider can't match (email mismatch, missing scope, casing), which surfaces as "authentication failed" rather than a mapping error.hwi_oauth config is firewall:-scoped, so a typo in the resource-owner name silently fails to register the listener and the callback URL 404s. Grep for the exact resource-owner id in Resources/config/ before assuming the bundle didn't load.OAuthUserResolver — it's the difference between a swap being a two-file change and a week of archaeology.How can I help you explore Laravel packages today?