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
- Host: GitHub
- URL: https://github.com/garbetjie/laravel-auth-passport-client
- Owner: garbetjie
- License: mit
- Created: 2020-03-20T12:11:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-23T06:29:20.000Z (about 5 years ago)
- Last Synced: 2025-02-08T06:16:21.029Z (3 months ago)
- Topics: guard, laravel, laravel-auth, laravel-passport
- Language: PHP
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.