2017 © Pedro Peláez
 

library laravel-token-auth

Laravel token auth cached.

image

digit-soft/laravel-token-auth

Laravel token auth cached.

  • Wednesday, July 25, 2018
  • by digitv
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Token auth for Laravel 7+

Component uses Redis to store token information, (*1)

Install

composer require "digit-soft/laravel-token-auth:~1.0"

Publish config

php artisan vendor:publish --provider="DigitSoft\LaravelTokenAuth\AuthServiceProvider" --tag=config

Configure guard

Change driver to token-cached in config/auth.php, (*2)

    'guards' => [
        ...
        'api' => [
            'driver' => 'token-cached',
            'provider' => 'users',
        ],
        ...
    ],

Ships with multiple middleware

  • DigitSoft\LaravelTokenAuth\Middleware\DefaultAuthGuard - set default auth guard to given value
  • DigitSoft\LaravelTokenAuth\Middleware\DefaultSessionDriver - set default session driver to given value
  • DigitSoft\LaravelTokenAuth\Middleware\AddGeneratedTokenToResponse - adds token generated during request to response header Some middleware useful for PHP-PM driven applications.

Sessions

There is possibility to save session data to token, if you will use package session handler DigitSoft\LaravelTokenAuth\Session\TokenSessionHandler, driver name is token-cached. You can also set it with DefaultSessionDriver middleware. Often rewritable data such as previous page, flashes and _token are not stored., (*3)

Events

There is DigitSoft\LaravelTokenAuth\Events\AccessTokenCreated, which fired every time token is created by TokenCached facade. So you can write or check information in AccessToken with own event listener., (*4)

Customization

  • You can use your own AccessToken implementation by extending original class and set its name in config.
  • You can set your own header name for AddGeneratedTokenToResponse middleware in config.

You can find more options and description in config file., (*5)

The Versions

25/07 2018

dev-master

9999999-dev

Laravel token auth cached.

  Sources   Download

MIT

The Requires

 

by Digit

auth tokens stateless auth laravel token auth