Overview
By default, Geni routes 404 outside thelocal environment:
config/geni.php
restrict_to_local and enable isolated documentation authentication.
Documentation authentication is completely decoupled from your application’s user table, database guards, and session cookies.
Supported Modes
Geni supports two authentication modes:form: A standalone HTML login page matching the docs UI theme.basic: Browser-native HTTP Basic Authentication prompt.
Form-Based Authentication (Recommended)
Set the mode toform and configure credentials in your .env file:
.env
config/geni.php:
config/geni.php
How Form Auth Works
- Unauthenticated visitors accessing
/docs/apiare redirected to/docs/api/login. - A login screen matching the docs portal dark/light theme is presented.
- Submitting valid credentials creates an isolated session under the session key
geni_docs_auth_logged_in. - Unauthenticated requests to the JSON specification (
/docs/api.jsonor/docs/api/v1.json) return an HTTP 401 JSON response ({"message": "Unauthorized."}), rather than an HTML redirect, preventing broken JSON parsers. - A logout button in the sidebar footer allows users to invalidate their session.
HTTP Basic Authentication
If you prefer browser-native authentication without session cookies:.env
Authorization: Basic ... headers will receive an HTTP 401 response with a WWW-Authenticate: Basic realm="API Documentation" header.
Disabling Authentication
To make documentation public in all environments (e.g. for open public developer portals), setusername and password to null:
.env