Skip to content

authmagic/authmagic-timerange-stateless-laravel-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

authmagic-timerange-stateless-laravel-middleware

Laravel facade for verification status of token recieved from Authorization header generated by authmagic authentication core.

How to install

$ composer require authmagic/authmagic-timerange-stateless-laravel-middleware

Publish the configurations

Run this on the command line from the root of your project for copy authmagic.php config to laravel config folder:

$ php artisan vendor:publish --provider="Authmagic\AuthmagicLaravel\AuthmagicServiceProvider"

Usage

Create middleware with handle method.

    public function handle($request, Closure $next)
    {
        $token = Authmagic::auth($request);

        if ($token) {
            // ...

            return $next($request);
        }

        return response('Unauthorized action', Response::HTTP_FORBIDDEN);
    }

Licence

authmagic-timerange-stateless-laravel-middleware is MIT licensed.