Reactor API Authorization
This documentation is still being written and may be incomplete.
This guide explains how to configure authorization for the Powerhouse Reactor API. Authorization controls who can access your Reactor and what they can do.
Introduction
The Reactor API is the API interface to a Powerhouse Reactor—a storage node responsible for storing documents, resolving conflicts, and verifying document event histories. Before users can interact with documents in your Reactor, they must pass through authorization checks.
Authorization Model
The Reactor API uses a layered authorization model:
| Component | Purpose | Scope |
|---|---|---|
Supreme Admin (ADMINS env var) | Full bypass of all permission checks | Reactor-wide |
| Document Protection | Determines whether a document requires explicit grants | Per-document |
| Document Permissions | Fine-grained READ/WRITE/ADMIN grants on specific documents | Per-document |
- For simple setups, configure
ADMINSand leave documents unprotected — any authenticated user can read and write - When you need fine-grained control, protect specific documents and manage access with document permissions
Prerequisites
Before configuring authorization, you need:
- A running Reactor: See Document Permissions - Starting the Reactor API for setup instructions
- User Ethereum addresses: Addresses of users you want to grant admin access to
Basic Configuration
The Reactor API supports two main ways to configure authorization:
- Using environment variables
- Using the powerhouse configuration file
Environment Variables
Configure authorization using environment variables before starting the Reactor:
# Required: Enable/disable authentication
AUTH_ENABLED=true
# Optional: Comma-separated list of admin wallet addresses (full access, bypasses all checks)
ADMINS="0x123...,0x456..."
# Optional: Make all new documents protected by default (requires explicit grants)
DEFAULT_PROTECTION=true
# Optional: Enable per-document permission management
DOCUMENT_PERMISSIONS_ENABLED=true
Important notes:
- Use full Ethereum addresses (e.g.,
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb) - ADMINS: These addresses bypass all permission checks entirely
- DEFAULT_PROTECTION=true: New documents are created as protected, requiring explicit grants for access
- DEFAULT_PROTECTION=false (default): New documents are unprotected — anyone can read, authenticated users can write
- DOCUMENT_PERMISSIONS_ENABLED=true: Enables the per-document permission system for managing grants
- If
AUTH_ENABLED=false, all authorization checks are bypassed (not recommended for production)
Powerhouse configuration
Alternatively, you can configure authorization in your powerhouse.config.json:
{
"auth": {
"enabled": true,
"admins": ["0x123", "0x456"]
}
}
How Authorization Works
Supreme Admin
Addresses listed in ADMINS have full access to the entire Reactor. They bypass all permission checks, including document protection. Use this for system administrators and project owners.
Document Protection
Each document (drive, folder, or document) can be either protected or unprotected:
| State | Read Access | Write Access |
|---|---|---|
| Unprotected | Anyone | Any authenticated user |
| Protected | Only users with explicit grants | Only users with explicit grants |
- Use
DEFAULT_PROTECTION=trueto make all new documents protected by default - Protection can also be toggled per-document via the GraphQL API
Per-Document Grants
When a document is protected, users need explicit grants to access it. Grants are managed through the Document Permission System and support:
- Direct grants: Assigned to a specific user address
- Group grants: Assigned to a group of users
- Inherited grants: Flow down from parent (drive → folder → document)
- Grant levels: READ, WRITE, or ADMIN
Docker Configuration
When running the Reactor API in Docker, you can pass these configurations as environment variables:
docker run -e AUTH_ENABLED=true \
-e ADMINS="0x123,0x456" \
-e DEFAULT_PROTECTION=true \
-e DOCUMENT_PERMISSIONS_ENABLED=true \
your-reactor-api-image
Authorization Flow
Understanding how authorization checks work:
User makes API request
|
Is AUTH_ENABLED=true?
|-- No --> Access granted (no auth required)
+-- Yes --> Continue to auth check
|
Does user have valid bearer token?
|-- No --> 401 Unauthorized
+-- Yes --> Extract Ethereum address from token
|
Is user's address in ADMINS?
|-- Yes --> Full access (bypass all checks)
+-- No --> Check document protection
|
Is the target document protected?
|-- No --> Read: allow, Write: allow (user is authenticated)
+-- Yes --> Check grants
|
Does user have a grant for this document?
|-- Yes --> Grant-level access (READ/WRITE/ADMIN)
+-- No --> 403 Forbidden
Step-by-Step
- Authentication check: If
AUTH_ENABLED=false, all requests are allowed (skip remaining steps) - Token validation: User must include valid bearer token from
ph access-token - Supreme admin check: If the user's address is in
ADMINS, grant full access - Document protection check: If the document is unprotected, allow read for everyone and write for authenticated users
- Grant check (protected documents only): Check document-level permissions for READ/WRITE/ADMIN grants
- Authentication (Renown flow): Proves who you are (
ph login) - Authorization (this guide): Determines what you can access
Common Scenarios
Scenario 1: Open Development Environment
You want a local Reactor where anyone can access everything:
AUTH_ENABLED=false
Use case: Local development, testing, demos
Scenario 2: Protected Production Environment
Only admins have unrestricted access, all documents require explicit grants:
AUTH_ENABLED=true
ADMINS="0xProjectLead"
DEFAULT_PROTECTION=true
DOCUMENT_PERMISSIONS_ENABLED=true
Use case: Private team workspace, sensitive data. Use document permissions to grant access to specific users.
Scenario 3: Open Collaboration with Admin Oversight
Any authenticated user can read and write, admins manage the Reactor:
AUTH_ENABLED=true
ADMINS="0xProjectLead"
Use case: Open source projects, community collaboration. Documents are unprotected by default, so any authenticated user can contribute. Protect specific documents as needed.
Scenario 4: Mixed Access
Some documents are open, others are restricted:
AUTH_ENABLED=true
ADMINS="0xProjectLead"
DOCUMENT_PERMISSIONS_ENABLED=true
Use case: Team workspace where most content is open but certain drives/documents are protected with explicit grants.
Security Best Practices
- Secure admin addresses: Keep admin wallet private keys secure
- Use HTTPS in production: Never expose the Reactor API over plain HTTP
- Regular access audits: Review admin list and document grants periodically
- Development vs Production: Use
AUTH_ENABLED=falseonly in local development - Protect sensitive documents: Use
DEFAULT_PROTECTION=trueor protect individual documents containing sensitive data - Use document permissions: For production, combine admin access with document-level permissions for fine-grained control
Troubleshooting
Common issues and solutions:
"403 Forbidden" Error
Problem: User has valid token but cannot access a document
Solutions:
- Check if the document is protected — if so, the user needs an explicit grant
- Verify the user's address is in
ADMINSif they need full access - Use document permissions to grant the user access to the specific document
- Verify wallet addresses are correctly formatted (full addresses, no typos)
"401 Unauthorized" Error
Problem: Request is rejected before reaching authorization
Solutions:
- User needs to authenticate:
ph login - Generate valid bearer token:
ph access-token - Include token in request header:
Authorization: Bearer <token> - Check token hasn't expired
Configuration Not Taking Effect
Problem: Changed configuration but nothing happens
Solutions:
- Restart the Reactor after configuration changes
- Check environment variables are set in the correct shell/environment
- Verify
powerhouse.config.jsonsyntax is valid JSON - Environment variables override config file - check for conflicts
How to Find a User's Ethereum Address
# User checks their own address
ph login --status
The address is shown in the authentication status output.
Next Steps
- Document Permissions: Set up fine-grained document permissions
- Authentication: Learn about the Renown authentication flow
- API Usage: Explore using the GraphQL API