PHPackages                             montross50/passport-consumer - 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. montross50/passport-consumer

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

montross50/passport-consumer
============================

Library to consume laravel passport, handle oauth endpoints, and map remote users to local

1.0.4(8y ago)010MITPHPPHP ~5.6|~7.0

Since Feb 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/montross50/passport-consumer)[ Packagist](https://packagist.org/packages/montross50/passport-consumer)[ Docs](https://github.com/montross50/passport-consumer)[ RSS](/packages/montross50-passport-consumer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (5)Used By (0)

Laravel Passport Consumer.
--------------------------

[](#laravel-passport-consumer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ca19813118c76f7dba522317659074e33b8faf9eb40501b0fb0b3b3abe939ce6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6e74726f737335302f70617373706f72742d636f6e73756d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/montross50/passport-consumer)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f33ee1769a7091850d49d543f5b46b8c76ecd21f1f857e848deadf0dc771a64a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d6f6e74726f737335302f70617373706f72742d636f6e73756d65722e7376673f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://travis-ci.org/montross50/passport-consumer)[![Total Downloads](https://camo.githubusercontent.com/e3ed44512f4d30f4e11ec8e19db718bbd569016a838bb503057f4b1a8a34f967/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6e74726f737335302f70617373706f72742d636f6e73756d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/montross50/passport-consumer)

This package lets you consume laravel passport local or remote with either the password grant flow or the authorization code flow. The aim is to allow you to focus on your app and leave oauth to passport and the consumption of said oauth to this package.

### Installation

[](#installation)

```
composer require montross50/passport-consumer

```

Environment configuration
-------------------------

[](#environment-configuration)

Publish the config file:

```
php artisan vendor:publish --provider="Montross50\PassportConsumer\PassportConsumerServiceProvider" --tag=config

```

There are a LOT of config options. Probably too many. The package should work out of the box with a default laravel install aside from defining the required env variables somewhere. The main config options to take note of are:

- enable\_pg
    - If set to true then the password grant routes are loaded.
- enable\_access
    - If set to true then the authorization code routes are loaded
- passport\_location
    - If set to local then it is assumed the given app is the app with passport installed. If not it is expected that this value is your passport server url.
- log\_user\_in
    - If set to true the following happens:
        - User is retrieved from user\_endpoint
        - If remote passport:
            - Find local user for remote user
            - Create local user using defaults and data from remote if not found
        - Log user in using session guard
        - The access\_token and refresh\_token will be in the session.

Required env variables:

- PC\_PASSPORT\_SECRET\_PG
    - The passport secret access key for you password grant client
- PC\_PASSPORT\_SECRET\_ACCESS
    - The passport secret access key for you authorization code client
- PC\_PASSPORT\_ID\_PG
    - The passport client id for your password grant client
- PC\_PASSPORT\_ID\_ACCESS
    - The passport client id for you authorization code client

### User Model

[](#user-model)

If you are working with a remote passport install then add the `Montross50\PassportConsumer\HasRemoteTokens` Trait to your Users model.

The log\_user\_in functionality will create users to pair with a remote user if the local user cannot be found. Default values and fields are defined on the trait and must be overridden if you need to add more defaults for new user.

### Run Migrations

[](#run-migrations)

This package adds an api\_token and configurable remote\_user\_id field to your users model. This only happens if you have your package configured for remote passport.

```
php artisan migrate

```

Change log
----------

[](#change-log)

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

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

[](#contributing)

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

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- Trent Schmidt

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

5

Last Release

2995d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26fd57a3cd2e5e126d0da83b969168f6fce20221ab46813ec38f080b08f11710?d=identicon)[montross50](/maintainers/montross50)

---

Tags

laravelpassportLaravel 5.6

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/montross50-passport-consumer/health.svg)

```
[![Health](https://phpackages.com/badges/montross50-passport-consumer/health.svg)](https://phpackages.com/packages/montross50-passport-consumer)
```

###  Alternatives

[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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