gupalo/google-auth-bundle
A Symfony bundle that adds Google authentication to your app, handling OAuth sign-in so users can log in with their Google accounts. It wires Google's auth flow into your existing security setup with minimal configuration.
First, confirm the target: gupalo/google-auth-bundle is a Symfony bundle, not a Laravel package. In a Laravel codebase you should normally reach for Laravel Socialite or the Google API client directly. Install this only if you are maintaining a Symfony app or explicitly bridging Symfony components into a Laravel-adjacent service.
Minimal steps when you do need it:
composer require gupalo/google-auth-bundleconfig/bundles.php (or bundles.php in older Symfony apps).client_id, client_secret, and an exact redirect_uri..env and reference them via %env(...)%; never hard-code them.config/packages/security.yaml or your login controller.Look first at the bundle’s service definitions and any provided authenticator/controller. The first practical use case is usually “Sign in with Google” for an internal admin or B2B app, mapping the Google profile email to a local user record.
Security authenticator pattern. If the bundle exposes a Symfony Security authenticator, register it on the relevant firewall and pair it with a custom user provider. The provider should look up users by Google subject ID first, then fall back to email. Avoid auto-creating users unless you have verified the email and decided on a domain restriction policy.
Controller/service pattern. Inject the bundle service into a controller, redirect the user to Google’s consent screen, then handle the callback by exchanging the code and fetching the profile. Keep the callback logic thin: validate state, fetch profile, delegate user mapping to a dedicated service.
Find-or-create mapping. A common day-to-day pattern:
google_id.email_verified_at set only after Google verification.Config and environment pattern. Keep Google credentials and redirect URI in environment variables. Use a single config file for scopes, hosted-domain restriction (hd), and post-login redirect targets. This makes staging/production swaps painless.
Domain restriction. For internal apps, pass the hd parameter or validate the returned email domain after the callback. Do not rely on the Google UI alone; enforce it server-side.
Event/logging integration. Emit your own login event after successful Google auth, and log failures with enough context to distinguish invalid_client, redirect_uri_mismatch, and user-cancelled consent.
state parameter on callback. If the bundle handles it, confirm it does so; if not, add it yourself..env, clear the Symfony cache. Env vars may be resolved at container compile time in some setups.debug:firewall/debug:config to confirm wiring.debug:container, debug:router, and Symfony logs. Common errors are redirect_uri_mismatch, invalid_client, and invalid_grant.How can I help you explore Laravel packages today?