kosmosx/auth

Auth service for Laravel / Lumen framework.

Maintainers

Details

github.com/KosmosX/auth

Source

Issues

Installs: 134

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:package

1.0.0 2019-08-24 11:10 UTC

This package is auto-updated.

Last update: 2024-11-25 21:03:01 UTC


README

Installation

composer require kosmosx/auth

php artisan kosmosx:publish:auth //if will be use JWT

Laravel

Add provider in array 'providers' (config/app.php)

Kosmosx\Auth\Providers\ManagerServiceProvider::class

Add to (config/auth.php)

'service_providers' => [
    'jwt' =>  env('AUTH_PROVIDERS', Tymon\JWTAuth\Providers\LaravelServiceProvider::class)
],

'guards' => [
    ...
    
    'api' => [
        'provider' => 'jwt',
        'driver' => 'jwt',
    ],
],
		
'providers' => [
    ...
    
    'jwt' => [
            'driver' => 'eloquent',
            'model' => env('AUTH_MODEL', App\Models\User::class),
        ],
]

Add to .env file

AUTH_PROVIDERS=Tymon\JWTAuth\Providers\LaravelServiceProvider

Lumen

File bootstrap/app.php

//uncomment this line:
$app->withFacades();
$app->withEloquent();

//Register providers
$app->register(Kosmosx\Auth\ManagerServiceProvider::class);

Add to .env file (Or change config/auth.php key of array 'providers')

AUTH_PROVIDERS=Tymon\JWTAuth\Providers\LumenServiceProvider

Example

AuthService::guard();  //return Illuminate/Guard

AuthService::getUser();  //return HttpException or Auth user

AuthService::refresh();  //return new token of Auth user

and other functions