Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Google Auth Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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-bundle
  • Register the bundle in config/bundles.php (or bundles.php in older Symfony apps).
  • Create/configure the bundle config with Google OAuth credentials: client_id, client_secret, and an exact redirect_uri.
  • Put credentials in .env and reference them via %env(...)%; never hard-code them.
  • Wire the bundle’s authenticator/service into config/packages/security.yaml or your login controller.
  • Add a login route that redirects to Google and a callback route that handles the authorization code.
  • Test with a real Google Cloud OAuth client; the callback URL must match exactly.

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.

Implementation Patterns

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:

  • Find local user by google_id.
  • If absent, find by verified email.
  • If still absent, create a user with a random password and email_verified_at set only after Google verification.
  • Update display name/avatar on each login if desired.
  • Assign default roles, then let your normal authorization layer take over.

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.

Gotchas and Tips

  • It is not Laravel-native. Laravel’s container will not autowire Symfony bundle services. Composer may also pull Symfony packages that conflict with Laravel’s dependency graph. Treat installation in Laravel as a red flag.
  • Maintenance risk is high. Last release was 2021, with very low stars and zero dependents. Audit the code before relying on it, pin the version, and be prepared to fork or replace it.
  • Redirect URI must match exactly. Scheme, host, port, path, and trailing slash all matter. This is the most common OAuth failure.
  • State handling matters. Verify the OAuth state parameter on callback. If the bundle handles it, confirm it does so; if not, add it yourself.
  • Config caching quirks. After changing bundle config or .env, clear the Symfony cache. Env vars may be resolved at container compile time in some setups.
  • Firewall ordering. In Symfony Security, authenticator order and firewall matching can silently skip your Google authenticator. Use debug:firewall/debug:config to confirm wiring.
  • Debugging tools. Use debug:container, debug:router, and Symfony logs. Common errors are redirect_uri_mismatch, invalid_client, and invalid_grant.
  • Extension points. Prefer decorating the bundle’s authenticator or service over editing vendor code. A custom user provider and event subscriber usually cover most customization needs.
  • Laravel alternative. For a Laravel app, use Laravel Socialite with a Google driver or the official Google API client. You will get better maintenance, native container integration, and fewer Symfony-specific surprises.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table