PHPackages                             startpulsing/op-laravel-socialite-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. startpulsing/op-laravel-socialite-auth

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

startpulsing/op-laravel-socialite-auth
======================================

Use socialite as a Laravel auth driver.

4.0(5y ago)02MITPHPPHP ^7.1.3

Since Feb 22Pushed 2y agoCompare

[ Source](https://github.com/OnePulse/op-laravel-socialite-auth)[ Packagist](https://packagist.org/packages/startpulsing/op-laravel-socialite-auth)[ Docs](https://github.com/stechstudio/laravel-socialite-auth)[ RSS](/packages/startpulsing-op-laravel-socialite-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (7)Used By (0)

Quickly integrate Laravel Socialite into a Laravel app
======================================================

[](#quickly-integrate-laravel-socialite-into-a-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5b8ae02c5b312574f8600924c444dc3b38955d38a0d31805a93231f374888820/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737465636873747564696f2f6c61726176656c2d736f6369616c6974652d617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stechstudio/laravel-socialite-auth)[![Build Status](https://camo.githubusercontent.com/9ffd78295a4afe6e0dcfb5e51c5421158ae755fbc4118f1d8516782fd3e29a01/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f737465636873747564696f2f6c61726176656c2d736f6369616c6974652d617574682f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/stechstudio/laravel-socialite-auth)[![Quality Score](https://camo.githubusercontent.com/6851b7f8975621cdefa68668752090eaf0ac7291c286b15e7c65c887055b8d36/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f737465636873747564696f2f6c61726176656c2d736f6369616c6974652d617574682e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stechstudio/laravel-socialite-auth)

This package provides quick wiring and simple configuration for the most common ways in which you may wish to integrate [Laravel Socialite](https://github.com/laravel/socialite) into your application. In addition it extends that authentication flow, enabling further logic to verify that a user meets your unique requirements before logging in.

### Currently supports:

[](#currently-supports)

- Use as the primary and only authentication for your application.
- Route-specific authentication alongside Laravel's own Auth scaffolding or other authentication drivers.
- Use for authentication into Laravel Nova in addition to or separate from front-end app authentication.

### Not yet provided

[](#not-yet-provided)

- OAuth-only authentication with Socialite, not requiring users to be present in a Laravel user provider.
- Use with multiple Socialite providers (eg. Google and Facebook).
- Use of different providers for different routes (eg. Facebook for frontend, Google for Nova).

Getting started
---------------

[](#getting-started)

1. Install the composer package

    ```
    composer require stechstudio/laravel-socialite-auth
    ```
2. [Configure the Socialite provider](https://laravel.com/docs/5.7/socialite#configuration) you wish to use in `config/services.php`, specifying the redirect path as either the named route of `socialite-auth.callback` or the relative path `/socialite-auth/callback`. For example:

    ```
    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_CLIENT_SECRET'),
        'redirect' => route('socialite-auth.callback')
    ],
    ```
3. Implement this package's `SocialiteAuthenticatable` Interface on each user class in your application that corresponds to a Socialite user. These two methods return the field and value which will be compared to the user returned by Socialite.

    ```
    public function getSocialiteIdentifierName()
    {
        return 'email';
    }

    public function getSocialiteIdentifier()
    {
        return $this->email;
    }
    ```

    By default these values will be compared to the `email` attribute returned from socialite. Below you may configure this and other options.
4. Beyond matching a Socialite user to one in your database, you may optionally provide a closure to ensure any additional requirements are met. Provide whatever logic you require by using this package's facade within your AppServiceProvider's `boot()` method as follows:

    ```
    SocialiteAuth::beforeLogin(function($user) {
        return str_contains($user->email, ['example.com']);
    });
    ```

Configuration
-------------

[](#configuration)

After publishing this package's configration, the following options will be available to you in `config/socialite-auth.php`.

FieldDescriptiondriverThe OAuth service to be used by Socialite. The corresponding credentials must be provided in your services config. The default is `google`.providerThe user provider which contains the users you are authenticating with Socialite. Default is `users`middlewareAdditional middleware to apply to the OAuth routes. Default is `web`.fieldThe socialite field which will be compared to the value returned by the `SocialiteAuthenticatable` interface. Default is `email`.Usage
-----

[](#usage)

### Use as primary authentication

[](#use-as-primary-authentication)

Remove any existing authentication routes, such as those added by Auth::routes(). Then in `config/auth.php`, set the default guard to `socialite`

```
'defaults' => [
    'guard' => 'socialite',
    ...
],
```

### Mixed authentication

[](#mixed-authentication)

1. This package includes its own Authenticate middleware which can be applied to perform the correct redirect in a mixed authentication environment. First add it to your route middleware in `app/Http/Kernel.php`.

    ```
    protected $routeMiddleware = [
        ...
        'socialite' => \STS\SocialiteAuth\Authenticate::class,
        ...
    ];
    ```
2. Further down, add it above the default Authenticate middleware in the priority array to ensure it takes priority over the default when applied.

    ```
    protected $middlewarePriority = [
        ...
        \STS\SocialiteAuth\Authenticate::class,
        \App\Http\Middleware\Authenticate::class,
        ...
    ];
    ```

Now you may freely specify Socialite authentication on some routes...

```
Route::get(...)->middleware(['auth:socialite', 'socialite']);
```

...and in-app authentication on others.

```
Route::get(...)->middleware('auth');
```

### Laravel Nova authentication

[](#laravel-nova-authentication)

Finally, it's quick to set up socialite authentication with Laravel Nova.

1. In the NovaServiceProvider added within your Providers directory, disable the authentication related routes which are generated by default. ```
    protected function routes()
    {
        Nova::routes();
            // ->withAuthenticationRoutes()
            // ->withPasswordResetRoutes()
            // ->register();
    }
    ```
2. If Socialite is configured as your default guard as above, you're all set. Otherwise add a `NOVA_GUARD` value to your .env file indicating that `socialite`is your desired guard. ```
    NOVA_GUARD=socialite

    ```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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.

###  Release Activity

Cadence

Every ~127 days

Recently: every ~149 days

Total

6

Last Release

2001d ago

Major Versions

1.2 → 2.02019-04-05

2.0 → 3.02019-12-10

3.0 → 4.02020-11-19

PHP version history (2 changes)1.0PHP ^7.1

3.0PHP ^7.1.3

### Community

Maintainers

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

---

Top Contributors

[![jszobody](https://avatars.githubusercontent.com/u/203749?v=4)](https://github.com/jszobody "jszobody (11 commits)")[![mattjmueller](https://avatars.githubusercontent.com/u/28371976?v=4)](https://github.com/mattjmueller "mattjmueller (10 commits)")[![barrywhyteop](https://avatars.githubusercontent.com/u/22006464?v=4)](https://github.com/barrywhyteop "barrywhyteop (4 commits)")

---

Tags

stechstudiolaravel-socialite-auth

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/startpulsing-op-laravel-socialite-auth/health.svg)

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

###  Alternatives

[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42442.0M544](/packages/socialiteproviders-manager)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[pschocke/laravel-telegram-login-widget

Easily integrate Telegrams login widget into your Laravel application to send Telegram messages

1610.4k](/packages/pschocke-laravel-telegram-login-widget)

PHPackages © 2026

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