An open API service indexing awesome lists of open source software.

https://github.com/garbetjie/laravel-auth-passport-client

A tiny package that makes Passport's OAuth client accessible as an authenticated user
https://github.com/garbetjie/laravel-auth-passport-client

guard laravel laravel-auth laravel-passport

Last synced: about 1 month ago
JSON representation

A tiny package that makes Passport's OAuth client accessible as an authenticated user

Awesome Lists containing this project

README

        

Laravel Auth Passport Client Guard
==================================

A really small and simple [auth guard](https://laravel.com/docs/6.x/authentication#introduction) for
[Laravel Passport](https://laravel.com/docs/6.x/passport) that treats the OAuth client just like a user.

When an OAuth client has authenticated using the `client_credentials` grant type, this package will allow you to access
the authenticated client through the `request()->user()` method call.

# Configuration

Configuration of this is really simple. Simply use the `passport-client` auth guard in `config/auth.php`:

```php
[
'client' => [
'driver' => 'passport-client',
'provider' => 'client',
]
],

'providers' => [
'client' => [
'driver' => 'eloquent',
'model' => Laravel\Passport\Client::class,
]
]
];
```

# Usage

When wanting to fetch the OAuth client that authenticated, simply call the `->user()` method on the request object with
the name of the configured guard:

```php
user('client');
// or
$client = $request->user('client');
}
}
```

# Changelog

* **2020-03-20**
* Initial release.