mark-domkan/env-token-auth

Adds the ability to use environtment token for the auth:api middleware.

1.0.0 2021-03-15 18:17 UTC

This package is auto-updated.

Last update: 2025-04-16 03:03:48 UTC


README

Latest Version on Packagist Total Downloads

Adds the ability to use token saved in env for the auth:api middleware.

Install

  1. Install the package with composer:

    composer require markdomkan/env-token-auth
  2. Set the api guard driver to env-token in the file config/auth.php:

    'guards' => [
        // ...
    
        'api' => [
            'driver'   => 'env-token', // <- Change this FROM token TO env-token
            
            // ...
        ],
    ],

Usage

  1. Add AUTH_TOKEN in .env file.

  2. Make a call with Authorization header with token (without Bearer).

License

The MIT License (MIT). Please see License File for more information.