PHPackages                             mpie/lighthouse-oauth2 - 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. [API Development](/categories/api)
4. /
5. mpie/lighthouse-oauth2

ActiveLibrary[API Development](/categories/api)

mpie/lighthouse-oauth2
======================

An OAuth2 implementation for Lighthouse

v0.4.3(4y ago)020MITPHPPHP ^7.3|^8.0

Since Dec 5Pushed 4y ago2 watchersCompare

[ Source](https://github.com/mpie/lighthouse-oauth2)[ Packagist](https://packagist.org/packages/mpie/lighthouse-oauth2)[ Docs](https://mpie.dev)[ RSS](/packages/mpie-lighthouse-oauth2/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (11)Used By (0)

lighthouse-oauth2
=================

[](#lighthouse-oauth2)

An OAuth2 implementation for Laravel Lighthouse through Passport

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

[](#installation)

To install run

```
composer require mpie/lighthouse-oauth2

```

ServiceProvider will be attached automatically.

Add the following env vars to your .env from the oauth\_clients and the password grant client.

```
LIGHTHOUSE_OAUTH2_CLIENT_ID=
LIGHTHOUSE_OAUTH2_CLIENT_SECRET=

```

You are done with the installation!

Tweaking configurations
-----------------------

[](#tweaking-configurations)

In case you need to point to a different url such as a subdomain that is running in the same app add (without the last slash):

```
LIGHTHOUSE_OAUTH2_DOMAIN="https://sub.domain.com"

```

Changing the grant type to 'password' instead of the default 'authorization\_code':

```
LIGHTHOUSE_OAUTH2_GRANT_TYPE="password"

```

Changing the default scope of '\*':

```
LIGHTHOUSE_OAUTH2_SCOPE="email,something,another"

```

Unique feature. You can change the default guard 'api' for the user lookup instead of being vendor locked:

```
LIGHTHOUSE_OAUTH2_GUARD="super-private-guard"

```

The user model is returned when login mutation is called. This can be disabled with:

```
LIGHTHOUSE_OAUTH2_FETCH_USER=false # Make sure you uncomment 'user: User' model in the graphql file

```

User column matching (will be applied when 'fetch\_user' is true). Defaults to 'email':

```
LIGHTHOUSE_OAUTH2_USER_COLUMN=id

```

Customizing the schema
----------------------

[](#customizing-the-schema)

```
php artisan vendor:publish --provider="Mpie\LighthouseOAuth\LighthouseOAuthServiceProvider"

```

This will publish the schema. There are no migration files.

Then update the `lighthouse-oauth2.php` configuration file to point the schema file to load the exported file instead of the one provided by the package.

```
/*
|--------------------------------------------------------------------------
| GraphQL schema
|--------------------------------------------------------------------------
|
| File path of the GraphQL schema to be used, defaults to null so it uses
| the default location
|
*/
'schema' => base_path('graphql/oauth2.graphql'),
```

From there you can customize the schema to fit your needs.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Total

9

Last Release

1577d ago

### Community

Maintainers

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

---

Top Contributors

[![mpie](https://avatars.githubusercontent.com/u/99145?v=4)](https://github.com/mpie "mpie (20 commits)")

---

Tags

laravelgraphqloauth2passportlaravel-graphqllighthouse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpie-lighthouse-oauth2/health.svg)

```
[![Health](https://phpackages.com/badges/mpie-lighthouse-oauth2/health.svg)](https://phpackages.com/packages/mpie-lighthouse-oauth2)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M531](/packages/laravel-passport)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[joselfonseca/lighthouse-graphql-passport-auth

Add GraphQL types and mutations for login and recover password functionalities

234769.9k1](/packages/joselfonseca-lighthouse-graphql-passport-auth)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[yakovenko/laravel-lighthouse-graphql-multi-schema

A Laravel package that provides multi-schema support for Lighthouse GraphQL.

1562.5k](/packages/yakovenko-laravel-lighthouse-graphql-multi-schema)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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