PHPackages                             abidra/laravel-google-auth - 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. abidra/laravel-google-auth

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

abidra/laravel-google-auth
==========================

Laravel Authentication Driver for Google OAuth authentication

0151PHP

Since Jun 10Pushed 9y agoCompare

[ Source](https://github.com/abidra/laravel-google-auth)[ Packagist](https://packagist.org/packages/abidra/laravel-google-auth)[ RSS](/packages/abidra-laravel-google-auth/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![The Monkeys](https://camo.githubusercontent.com/580df7170b07322a64b603ab110484f004b2464ccf1a56e9fc2b3dad16b39378/687474703a2f2f7777772e7468656d6f6e6b6579732e636f6d2e61752f696d672f6d6f6e6b65795f6c6f676f2e706e67)](https://camo.githubusercontent.com/580df7170b07322a64b603ab110484f004b2464ccf1a56e9fc2b3dad16b39378/687474703a2f2f7777772e7468656d6f6e6b6579732e636f6d2e61752f696d672f6d6f6e6b65795f6c6f676f2e706e67)

Laravel Google Authentication Driver
====================================

[](#laravel-google-authentication-driver)

Allows you to use Google to authenticate users of your Laravel application.

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

[](#installation)

To get the latest version of cachebuster simply require it in your composer.json file.

> **Note**: This package depends on a non-packagist package, google-api-php-client, so you will need to manually add the following repository definition to your project's `composer.json` file before attempting to run `composer update`or `composer install`:

```
	"repositories": [
		{
      "type": "package",
      "package": {
        "name": "google/google-api-php-client",
        "version": "0.6.7",
        "dist": {
          "url": "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.6.7.tar.gz",
          "type": "tar"
        },
        "autoload": {
          "classmap": ["src/"]
        }
      }
		}
	],
```

```
composer require themonkeys/laravel-google-auth:dev-master --no-update
composer update themonkeys/laravel-google-auth
```

Once the package is installed you need to register the service provider with the application. Open up `app/config/app.php` and find the `providers` key.

Delete the line for the AuthServiceProvider:

```
'providers' => array(
		'Illuminate\Auth\AuthServiceProvider',
)
```

and replace it with:

```
'providers' => array(
    'Themonkeys\LaravelGoogleAuth\LaravelGoogleAuthServiceProvider',
)
```

To configure the package, you can use the following command to copy the configuration file to `app/config/packages/themonkeys/laravel-google-auth`.

```
php artisan config:publish themonkeys/laravel-google-auth
```

Or you can just create a new file in that folder and only override the settings you need.

The settings themselves are documented inside `config.php`.

To make your configuration apply only to a particular environment, put your configuration in an environment folder such as `app/config/packages/themonkeys/laravel-google-auth/environment-name/config.php`.

Usage
-----

[](#usage)

To enable Google-based authentication for your app, you first need to select the 'google' authentication driver. Open up `app/config/auth.php` and edit the `driver` key:

```
return array(
	'driver' => 'google',
);
```

For Google authentication, you need to add a Login page to your app which contains a link for the user to click on that will initiate the authentication process. The simplest way of doing that is to add the following to your `routes.php`file:

```
Route::get('/login', function() {
    return View::make('login', array(
      'authUrl' => Auth::getAuthUrl()
    ));
});
```

> **Note**: the getAuthUrl() is not present in other authentication drivers, so the above code will throw an error with other drivers.

Then use `{{ $authUrl }}` as the `href` for a link in your `login.blade.php` view:

```
Connect Me!
```

Then you need to add the `'before'` filter `'google-finish-authentication'` to the route that google redirects to after authentication is complete. Make sure this filter is applied first, before the `'auth'` filter - otherwise the `'auth'`filter will send the user back to the login page and their session will be lost.

```
Route::group(array('before' => array('google-finish-authentication', 'auth')), function() {
    Route::get('/', 'HomeController@showWelcome');
});
```

Adding a logout facility to your app is the same as with any other authentication driver - just add the following to your `routes.php`, then add a link to the URI `/logout` wherever you need it:

```
Route::get('/logout', function() {
    Auth::logout();
    return Redirect::to('/');
});
```

All information available in the `Google_Userinfo` object is available via the user object returned from `Auth::user()`, for example `Auth::user()->name`:

```

            Your ID:{{ Auth::user()->id }}

            Your Full Name:{{ Auth::user()->name }}

            Your Given Name:{{ Auth::user()->given_name }}

            Your Family Name:{{ Auth::user()->family_name }}

            Your Email Address:{{ Auth::user()->email }}

            Your Email Address has
                @if (Auth::user()->verified_email)
                been verified
                @else
                not been verified
                @endif

            Your hosted domain:{{ Auth::user()->hd }}

            Your Locale:{{ Auth::user()->locale }}

```

Contribute
----------

[](#contribute)

In lieu of a formal styleguide, take care to maintain the existing coding style.

License
-------

[](#license)

MIT License (c) [The Monkeys](http://www.themonkeys.com.au/)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/79029?v=4)[Zeeshan Abid](/maintainers/abid)[@abid](https://github.com/abid)

---

Top Contributors

[![felthy](https://avatars.githubusercontent.com/u/1940215?v=4)](https://github.com/felthy "felthy (14 commits)")[![grayxr](https://avatars.githubusercontent.com/u/4734952?v=4)](https://github.com/grayxr "grayxr (7 commits)")[![abidra](https://avatars.githubusercontent.com/u/26470350?v=4)](https://github.com/abidra "abidra (6 commits)")[![MichelYpma](https://avatars.githubusercontent.com/u/298719?v=4)](https://github.com/MichelYpma "MichelYpma (1 commits)")[![taledo](https://avatars.githubusercontent.com/u/227568?v=4)](https://github.com/taledo "taledo (1 commits)")

### Embed Badge

![Health badge](/badges/abidra-laravel-google-auth/health.svg)

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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