By default, Geni routes return a 404 response outside the
local environment, controlled by 'restrict_to_local' => true in config/geni.php. You must set this to false before portal authentication takes effect in staging or production.Supported Modes
Geni supports two authentication modes for the docs portal:form— A standalone HTML login page that matches the docs portal dark/light theme.basic— Browser-native HTTP Basic Authentication via aWWW-Authenticatechallenge header.
Form-Based Authentication
Form authentication is the recommended mode. It presents a themed login screen, stores an authenticated session under an isolated key, and handles unauthenticated API spec requests gracefully so JSON parsers never receive an unexpected HTML redirect. Set your credentials in.env:
.env
config/geni.php:
config/geni.php
1
Redirect to login
Unauthenticated visitors accessing
/docs/api are redirected to /docs/api/login, where a themed login form is rendered.2
Validate credentials
On form submission, Geni checks the provided username and password against the configured values.
3
Create isolated session
Valid credentials create a session entry under the key
geni_docs_auth_logged_in — separate from any existing application session.4
JSON spec protection
Unauthenticated requests to the raw JSON spec (e.g.
/docs/api.json, /docs/api/v1.json) return an HTTP 401 JSON response ({"message": "Unauthorized."}) rather than an HTML redirect, preventing broken JSON parsers.5
Sign out
A logout button in the sidebar footer lets authenticated users invalidate their session at any time.
HTTP Basic Authentication
If you prefer browser-native authentication without session cookies, use thebasic mode. Any request without a valid Authorization: Basic … header receives an HTTP 401 response with a WWW-Authenticate: Basic realm="API Documentation" header, triggering the browser’s built-in credentials dialog.
.env
Disabling Authentication
To make the documentation portal fully public — for example, when building an open developer portal — set both credentials tonull:
.env
mode.