Add OAuth2 authorization server for delegated read-only API access #6172
No reviewers
Labels
No labels
Focus: A11y
Focus: Admin/Meta
Focus: Authentication
Focus: Back-End
Focus: Database
Focus: Design & UX
Focus: Editor - Markdown
Focus: Editor - WYSIWYG
Focus: Export System
Focus: Front-End
Focus: Translations
Focus: View Customization
Is: Docs Update
Is: Enhancement
Is: Priority
Is: Security
Is: Upstream
Status
Blocked
Status
Open to discussion
Status
Out of scope
Status
Pending Validation
Type
API Request
Type
Bug Report
Type
Feature Request
Type
Happy feedback
Type
Maintenance
Type
Question
Type
Support
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bookstack/bookstack!6172
Loading…
Reference in a new issue
No description provided.
Delete branch "poulpreben/bookstack:oauth-authorization-server"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #5614
User story: As a user, I want to securely grant applications read access to BookStack on my behalf, without handing out long-lived API tokens. This unlocks use cases like MCP servers and CLI tools that authenticate as the actual user with their normal permissions.
What this adds:
GET/POST /oauth/authorizewith a consent screen (uses the normal BookStack login, works with all auth methods)POST /oauth/tokenwith authorization code + refresh token grants, PKCE (S256) requiredreadscope enforced server-side (safe HTTP methods only)Deliberately kept small: hand-rolled minimal OAuth2 following existing BookStack patterns (no league/oauth2-server dependency), one
readscope for now, no dynamic client registration. Happy to adjust scope or approach to whatever fits the project best.Screenshots
Consent screen (as seen by the authorizing user)

My Account: connected applications with revoke

Settings: app connections list

Create form with confidential/public toggle

One-time client secret reveal after creation

View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.