PHPackages                             dusterio/laravel-google-guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. dusterio/laravel-google-guard

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

dusterio/laravel-google-guard
=============================

Auth guard for Laravel that completely relies on Google Login and doesn't persist

0.1.5(7y ago)6350[1 issues](https://github.com/dusterio/laravel-google-guard/issues)MITPHPPHP &gt;=5.5.0

Since Apr 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/dusterio/laravel-google-guard)[ Packagist](https://packagist.org/packages/dusterio/laravel-google-guard)[ Docs](https://github.com/dusterio/laravel-google-guard)[ RSS](/packages/dusterio-laravel-google-guard/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (4)Versions (7)Used By (0)

laravel-google-guard
====================

[](#laravel-google-guard)

[![Latest Stable Version](https://camo.githubusercontent.com/deb9ababcc171c158476d91459e8ac74d2c70c677c8617ee881a6fee48e04ceb/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d676f6f676c652d67756172642f762f737461626c65)](https://packagist.org/packages/dusterio/laravel-google-guard)[![Total Downloads](https://camo.githubusercontent.com/de3ef7c31774ebc5dad6369398db191b904b707f3778d33d135467ce3b69b894/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d676f6f676c652d67756172642f646f776e6c6f616473)](https://packagist.org/packages/dusterio/laravel-google-guard)[![License](https://camo.githubusercontent.com/ff05dd2286d437e1712981501483dcdc7a1f25e6817f102ade060182f2f6851e/68747470733a2f2f706f7365722e707567782e6f72672f647573746572696f2f6c61726176656c2d676f6f676c652d67756172642f6c6963656e7365)](https://packagist.org/packages/dusterio/laravel-google-guard)

Auth guard for Laravel that completely relies on Google Login and doesn't persist

Overview
--------

[](#overview)

Sometimes your small application doesn't need local persisted user repository at all. At times like that, it's nice to rely on external account repository, eg. Google – nowadays practically everybody got a Google account?

This authentication guard relies on Google token. Every time your app needs to authenticate a user, it will redirect user to Google, then back. If the token is valid, your user will be considered authenticated within your app.

No persistence at all, just some session caching.

And you can of course specify allowed Google users or domains if your application is private.

Dependencies
------------

[](#dependencies)

- Laravel Socialite
- Laravel 5.3.\*

Installation
------------

[](#installation)

First install the package using Packagist:

```
$ composer require dusterio/laravel-google-guard

```

Add the package service provider to your `config/app.php` to `providers` array:

```
Dusterio\LaravelGoogleGuard\Integrations\LaravelServiceProvider::class,
```

You should see two extra routes after this:

```
$ php artisan route:list
| GET|HEAD | auth/google            |                   | Dusterio\LaravelGoogleGuard\Http\LoginController@redirectToProvider     | guest,web    |
| GET|HEAD | auth/google/callback   |                   | Dusterio\LaravelGoogleGuard\Http\LoginController@handleProviderCallback | guest,web    |
```

Configure the guard in `config/auth.php`:

```
    'guards' => [
        /// Your existing guards
        /// ...
        'google' => [
            /*
             * For consistency, return a dummy (not persisted) class holder.
            */
            'userClass' => '\App\User',

            /*
             * Remember users for this number of seconds.
             */
            'timeout' => 3600,

            /*
             * Users that can use the app. If left empty, everybody is allowed.
             */
            'whitelist' => [
                'admin@.',
            ]
        ]
    ]
```

Make it a default guard in the same file `config/auth.php`:

```
        'web' => [
            'driver' => 'google',
            'provider' => 'users',
        ],
```

Add your google key and secret to `config/services.php`, eg.:

```
    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_CLIENT_SECRET'),
        'redirect' => env('APP_URL') . '/auth/google/callback',
    ],
```

That's it – you are ready to go!

License
-------

[](#license)

MIT License

Copyright (c) 2017 Denis Mysenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~106 days

Recently: every ~132 days

Total

6

Last Release

2739d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a44ee42fe69a7926153637c0249b0faf83a1a67edd1231f449a74dcf5721c345?d=identicon)[dusterio](/maintainers/dusterio)

---

Top Contributors

[![dusterio](https://avatars.githubusercontent.com/u/11039918?v=4)](https://github.com/dusterio "dusterio (14 commits)")

---

Tags

authenticationgoogleguardlaravelphplaravelgoogleAuthenticationguard

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dusterio-laravel-google-guard/health.svg)

```
[![Health](https://phpackages.com/badges/dusterio-laravel-google-guard/health.svg)](https://phpackages.com/packages/dusterio-laravel-google-guard)
```

###  Alternatives

[alajusticia/laravel-logins

Sessions and Sanctum tokens tracking in Laravel apps, users notification on new login, multiple remember tokens, IP geolocation, User-Agent parser

1910.3k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
