devuniverse / api-user-provider-1
Laravel UserProvider over rest api
v0.2.0
2018-07-10 19:31 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ~6.3
- illuminate/contracts: ^5.5
- illuminate/support: ^5.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.8
- orchestra/testbench: ~3.6.0
- phpunit/phpunit: ~7.0
README
Install
Add repository to composer.json file.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cesg/api-user-provider"
}
]
Add composer dependecie
composer require cesg/api-user-provider
Configuration
publish the config file
php artisan vendor:publish --provider="Cesg\Auth\Provider\ApiUserServiceProvider" --tag="config"
return [ 'uri' => env('', 'localhost/api/v1/users'), 'bearer_token' => env('USER_PROVIDER_API_TOKEN', ''), 'headers' => [] ];
Set the driver in auth config file.
return [ 'providers' => [ 'users' => [ 'driver' => 'api-users', 'model' => Cesg\Auth\Provider\User::class, ] ], ]
If you use laravel/passport need extend the Cesg\Auth\Provider\User and add the trait Laravel\Passport\HasApiTokens and set the provider model to you own class.
class User extends \Cesg\Auth\Provider\User { use HasApiTokens; }