Add OAuth2 server module with token verification and management APIs #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements OAuth2 server functionality for token verification, validation, and personal access token management.
New APIs
Token Verification
GET /oauth/token/info- Verify token validity with expiration checkGET /oauth/token/details- Get comprehensive token metadataPOST /oauth/token/validate- Validate token from request bodyPersonal Access Token Management
GET /oauth/personal-access-tokens- List user's tokensPOST /oauth/personal-access-tokens- Create token (returns once)DELETE /oauth/personal-access-tokens/:token_id- Revoke tokenHealth Check
GET /ayaka/oauth2-server- Module status endpointImplementation
Module Structure (
services/web/modules/oauth2-server/)SecretsHelper.js- SHA-512 token hashing (matches existing Overleaf OAuth implementation)Oauth2Server.js- Token lookup, verification, and expiration logicOAuthPersonalAccessTokenManager.mjs- CRUD operations onoauthAccessTokenscollectionTokenController.js- Token verification endpoints with Bearer token extractionOAuthPersonalAccessTokenController.js- Protected endpoints requiring loginOauth2ServerRouter.mjs- Route definitionsToken Format
olpat_(64 hex chars)oauthAccessTokens.accessTokenaccessTokenPartiallastUsedAton each useUsage
Configuration
Added
oauth2-servertomoduleImportSequenceinservices/web/config/settings.defaults.jsfor automatic module loading.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.