Search by

oralunal / scribe-auth

oralunal

A Laravel middleware package that adds authentication protection to your Scribe API documentation.

Package info

github.com/oralunal/scribe-auth

Homepage

pkg:composer/oralunal/scribe-auth

Statistics

Installs: 2 500

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

v1.2.0 2026-11-17 10:14 UTC

This package is auto-updated.

Last update: 2026-11-17 10:22:08 UTC


README

A Laravel middleware package that adds authentication protection to your Scribe API documentation. This package provides a simple way to secure your API documentation with basic authentication, ensuring that only authorized users can access your API documentation pages.

Requirements

  1. Scribe's type config should be set to laravel in your config/scribe.php file.
  2. Scribe's laravel->add_routes config should be set to true in your config/scribe.php file.

Installation

  1. Install the package via Composer:
composer require oralunal/scribe-auth
  1. Add the web and scribe.auth middleware to your config/scribe.php file:
'middleware' => [
    // ...
    'web',
    'scribe.auth',
],
  1. Publish the configuration file:
php artisan vendor:publish --tag=scribe-auth-config

Configuration

The package comes with a config file (config/scribe_auth.php) where you can customize the following settings:

  • SCRIBE_AUTH_ENABLED: Enable/disable the middleware (Default: false)
  • SCRIBE_AUTH_PASSWORD: Authentication password (Default: none). If it is missing or empty, the login is locked: every attempt is refused. A config file that you published before v1.2.0 still has the old 123456789 fallback: see Upgrading to v1.2.0.
  • SCRIBE_AUTH_MAX_ATTEMPTS: Login attempts per minute for each user or IP address (Default: 5)

Add the following environment variable to your .env file:

SCRIBE_AUTH_ENABLED=true
SCRIBE_AUTH_PASSWORD=your_fantastic_password

Security

  • Use different credentials in production
  • Choose a strong password
  • Keep your credentials secure

The login fails closed: when the configured password is missing or empty, every attempt is refused. A config file that you published before v1.2.0 still has a fallback value: see Upgrading to v1.2.0. The password is compared with hash_equals, and the session id is regenerated after a correct login.

Upgrading to v1.2.0

  • A missing password now locks the login. Before v1.2.0, the package config used 123456789 when SCRIBE_AUTH_PASSWORD was not set. Set SCRIBE_AUTH_PASSWORD before you upgrade if you use the default config.
  • Check your published config. If you published config/scribe_auth.php before v1.2.0, your copy still has env('SCRIBE_AUTH_PASSWORD', '123456789'), and your copy wins over the package config. Change that line to env('SCRIBE_AUTH_PASSWORD') by hand.

Testing

composer install
composer test

License

This package is open-sourced software licensed under the MIT license.