PHPackages                             kregel/laravel-flight - 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. kregel/laravel-flight

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

kregel/laravel-flight
=====================

Secure your apps easily with Laravel Socialite and OAuth. Install this package, configure a few env values, a config/services.php entry, and then login.

1.0.2(1y ago)3315MITPHPPHP &gt;=8.0

Since Mar 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/austinkregel/laravel-flight)[ Packagist](https://packagist.org/packages/kregel/laravel-flight)[ Docs](https://github.com/kregel/laravel-flight)[ RSS](/packages/kregel-laravel-flight/feed)WikiDiscussions main Synced 1mo ago

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

Stop publishing apps with public horizon access.
================================================

[](#stop-publishing-apps-with-public-horizon-access)

Secure your apps easily with Laravel Socialite and OAuth. Install this package, configure a few env values, a config/services.php entry, and then login. Never leave your apps unprotected.

[![Latest Version on Packagist](https://camo.githubusercontent.com/efce95784210750597661cd9120ae577d5f8eea7f66253ef608659228bce9744/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b726567656c2f6c61726176656c2d666c696768742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kregel/laravel-flight)[![Total Downloads](https://camo.githubusercontent.com/bcfb43de0f193f33b012df3e81d7264c9007381b4e179745a08b763f4e0871e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b726567656c2f6c61726176656c2d666c696768742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kregel/laravel-flight)

Streamline your Authentication even further. Integrate with your own internal Laravel Passport instance and enable your users to login however they need to.

Stop dealing with setting up a /login redirect and /callback. Not all apps need their own auth system. Sometimes we just want to login with an existing platform like Github, Auth0, or even a custom Laravel Passport instance. While this still does have it's own user's table, it's largely used for tracking social users.

### Ok but why?

[](#ok-but-why)

Because there are Laravel tools out there that don't come with authentication, but require it to be able to secure them for production access.

This package let's you grab your favorite Github, Google, or other supported OAuth provider's credentials, set them in your env, visit `http://yoururl/flight/login` and login. You should be redirected to the auth provider you chose as your `FLIGHT_DRIVER`, and you will then be redirected to `FLIGHT_LOGIN_REDIRECT`.

Users that don't exist at the time of the request will be created unless you explicitly disable registration with an env var (so turn it off after you registery) `FLIGHT_ALLOW_REGISTRATION`

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

[](#installation)

You can install the package via composer:

```
composer require kregel/laravel-flight
```

Publish the config

```
php artisan vendor:publish --provider=Kregel\\Flight\\FlightServiceProvider

```

Find a [socialite provider](https://socialiteproviders.com/about/) you wish to use

Add their ExtendSocialite event to our config file under the `community_drivers` section, and if you wish to make it your primary driver, set your `FLIGHT_DRIVER`

Post setup
----------

[](#post-setup)

You'll want to verify that you have your `web` middleware configured. And you'll want the `auth` middleware too, so Laravel will redirect you to your auth provider.

If you're reading a headless type of system and have removed those middlewares here's basically the same stuff.

In your `app/Http/Kernel.php` the `web` middleware would basically be

```
    protected $middlewareGroups = [
        'web' => [
            \Illuminate\Cookie\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \Illuminate\Foundation\Http\Middleware\VerifyCsrfToke::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
    ];
```

And under the `$middlewareAliases` portion you can add the following replacement for `App\Http\Middleware\Authenticate`

```
'auth' => \Kregel\Flight\Middleware\Authenticate::class,
'guest' => \Kregel\Flight\Middleware\RedirectIfAuthenticated::class,
```

Both of the above middleware are almost directly taken from the base Laravel app, with minor adjustments for configuration.

Integrating new socialite providers
-----------------------------------

[](#integrating-new-socialite-providers)

To add a new authentication provider to your app, you'll need to `composer require` their package into your app, then add their ExtendSocialite listener to the `community_drivers` page. Once the driver has been added, you'll need to open your `config/services.php` file and add the following equivalent for your driver . Replacing `driver_name` and `DRIVER_NAME` with your actual driver.

```
'driver_name' => [
    'client_id' => env('DRIVER_NAME_CLIENT_ID'),
    'client_secret' => env('DRIVER_NAME_CLIENT_SECRET'),
    'redirect' => env('DRIVER_NAME_REDIRECT_URI'),
],
```

If your preferred driver is github, then it'll look like this:

```
'github' => [
    'client_id' => env('GITHUB_CLIENT_ID'),
    'client_secret' => env('GITHUB_CLIENT_SECRET'),
    'redirect' => env('GITHUB_REDIRECT'),
],
```

Lastly, change your `FLIGHT_DRIVER` env var to your preferred driver.

And visit `http://yourwebsite/flight/login`

If you haven't already set up the redirect url or callback url `http://yourwebsite/flight/callback`

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Austin Kregel](https://github.com/kregel)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~98 days

Recently: every ~103 days

Total

6

Last Release

659d ago

Major Versions

0.0.3 → 1.0.02023-09-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c5c1ee0adf552aec8a54c1760dd99c4d1b90c0360dccafeef849a14ff37f706?d=identicon)[austinkregel](/maintainers/austinkregel)

---

Top Contributors

[![austinkregel](https://avatars.githubusercontent.com/u/5355937?v=4)](https://github.com/austinkregel "austinkregel (25 commits)")

---

Tags

authenticationhacktoberfestlaravellaravel-packagelaravel-socialiteoauthsocialitelaravelAuthenticationoauthsocialitehorizonkregellaravel-flight

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kregel-laravel-flight/health.svg)

```
[![Health](https://phpackages.com/badges/kregel-laravel-flight/health.svg)](https://phpackages.com/packages/kregel-laravel-flight)
```

###  Alternatives

[socialiteproviders/manager

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

42442.0M544](/packages/socialiteproviders-manager)[socialiteproviders/microsoft

Microsoft OAuth2 Provider for Laravel Socialite

326.1M13](/packages/socialiteproviders-microsoft)[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)[socialiteproviders/instagram

Instagram OAuth2 Provider for Laravel Socialite

421.9M5](/packages/socialiteproviders-instagram)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

2073.7k](/packages/kovah-laravel-socialite-oidc)[socialiteproviders/kakao

Kakao OAuth2 Provider for Laravel Socialite

10484.7k4](/packages/socialiteproviders-kakao)

PHPackages © 2026

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